segfault
このコミットが含まれているのは:
コミット
cf7147a90f
6
main.c
6
main.c
|
@ -78,7 +78,11 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
if (argc == 3) {
|
if (argc == 3) {
|
||||||
if (strcmp(argv[1], "-i") == 0) initpass(argv[2]);
|
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], "-y") == 0) yankpass(argv[2]);
|
||||||
else if (strcmp(argv[1], "-a") == 0) addpass(argv[2]);
|
else if (strcmp(argv[1], "-a") == 0) addpass(argv[2]);
|
||||||
else if (strcmp(argv[1], "-d") == 0) delpass(argv[2], 0);
|
else if (strcmp(argv[1], "-d") == 0) delpass(argv[2], 0);
|
||||||
|
|
|
@ -68,10 +68,8 @@ const char *showpass(char *file) {
|
||||||
if (gpgfile == NULL) {
|
if (gpgfile == NULL) {
|
||||||
if (strncmp(lang, "en", 2) == 0) {
|
if (strncmp(lang, "en", 2) == 0) {
|
||||||
perror("Failed to opening file");
|
perror("Failed to opening file");
|
||||||
fprintf(stderr, "Failing path: %s\n", gpgpath);
|
|
||||||
} else {
|
} else {
|
||||||
perror("ファイルを開くに失敗");
|
perror("ファイルを開くに失敗");
|
||||||
fprintf(stderr, "失敗したパス: %s\n", gpgpath);
|
|
||||||
}
|
}
|
||||||
free(gpgpath);
|
free(gpgpath);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
読み込み中…
新しいイシューから参照