From 679876d50a792d3c09ca2f1b88e66044342bf9d5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E8=AB=8F=E8=A8=AA=E5=AD=90?= Date: Thu, 30 Nov 2023 00:15:11 +0900 Subject: [PATCH] =?utf8?q?=E7=A2=BA=E8=AA=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- addpass.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/addpass.c b/addpass.c index 3ac8e01..2aed233 100644 --- a/addpass.c +++ b/addpass.c @@ -201,6 +201,14 @@ void addpass(char* file) { } snprintf(gpgpath, alllen, "%s%s%s%s", homedir, basedir, file, ext); + struct stat statbuf; + if (stat(gpgpath, &statbuf) == 0) { + free(gpgpath); + cleanup(ctx, key[0], in, out); + fprintf(stderr, "パスワードは既に存在しています。\n"); + return; + } + gpgfile = fopen(gpgpath, "wb"); if (gpgfile == NULL) { perror("ファイルを開くに失敗。"); -- 2.43.0