From: 諏訪子 Date: Wed, 22 May 2024 01:35:22 +0000 (+0900) Subject: segfault X-Git-Tag: sp-1.3.0~12 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=cf7147a90fa84d3af699ed369355e470ec3a7536;p=sp.git segfault --- diff --git a/main.c b/main.c index 5d61ba6..e198893 100644 --- a/main.c +++ b/main.c @@ -78,7 +78,11 @@ int main(int argc, char *argv[]) { if (argc == 3) { if (strcmp(argv[1], "-i") == 0) initpass(argv[2]); - else if (strcmp(argv[1], "-s") == 0) printf("%s\n", showpass(argv[2])); + else if (strcmp(argv[1], "-s") == 0) { + const char *pass = showpass(argv[2]); + if (pass == NULL) return -1; + printf("%s\n", pass); + } else if (strcmp(argv[1], "-y") == 0) yankpass(argv[2]); else if (strcmp(argv[1], "-a") == 0) addpass(argv[2]); else if (strcmp(argv[1], "-d") == 0) delpass(argv[2], 0); diff --git a/src/showpass.c b/src/showpass.c index 9d422d0..3347004 100644 --- a/src/showpass.c +++ b/src/showpass.c @@ -68,10 +68,8 @@ const char *showpass(char *file) { if (gpgfile == NULL) { if (strncmp(lang, "en", 2) == 0) { perror("Failed to opening file"); - fprintf(stderr, "Failing path: %s\n", gpgpath); } else { perror("ファイルを開くに失敗"); - fprintf(stderr, "失敗したパス: %s\n", gpgpath); } free(gpgpath); return NULL;