From: 諏訪子 Date: Wed, 29 Nov 2023 15:15:11 +0000 (+0900) Subject: 確認 X-Git-Tag: sp-1.0.0~2 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=679876d50a792d3c09ca2f1b88e66044342bf9d5;p=sp.git 確認 --- 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("ファイルを開くに失敗。");