OpenBSDでのコンパイラーが発生された問題を修正した

このコミットが含まれているのは:
守矢諏訪子 2023-12-01 13:26:30 +09:00
コミット c42f23f79f
5個のファイルの変更18行の追加7行の削除

ファイルの表示

@ -1,3 +1,6 @@
# 1.1.2
* OpenBSDでのコンパイラーが発生された問題を修正した
# 1.1.1 # 1.1.1
* make install-zsh部分を修正 * make install-zsh部分を修正

ファイルの表示

@ -1,10 +1,10 @@
NAME=sp NAME=sp
VERSION=1.1.1 VERSION=1.1.2
# Linux、Haiku、かIllumos = /usr、FreeBSDかOpenBSD = /usr/local、NetBSD = /usr/pkg # Linux、Haiku、かIllumos = /usr、FreeBSDかOpenBSD = /usr/local、NetBSD = /usr/pkg
PREFIX=/usr PREFIX=/usr
CC=cc CC=cc
FILES=main.c showpass.c yankpass.c addpass.c delpass.c listpass.c genpass.c initpass.c otppass.c FILES=main.c showpass.c yankpass.c addpass.c delpass.c listpass.c genpass.c initpass.c otppass.c
CFLAGS=-Wall -Wextra -g CFLAGS=-Wall -Wextra -g -I${PREFIX}/include -L${PREFIX}/lib
LDFLAGS=-lgpgme -lcrypto LDFLAGS=-lgpgme -lcrypto
all: all:

2
main.c
ファイルの表示

@ -16,7 +16,7 @@
void helpme(); void helpme();
const char* sofname = "sp"; const char* sofname = "sp";
const char* version = "1.1.1"; const char* version = "1.1.2";
void helpme() { void helpme() {
printf(" sp - シンプルなパスワードマネージャー\n"); printf(" sp - シンプルなパスワードマネージャー\n");

ファイルの表示

@ -18,7 +18,7 @@ void clean_up(gpgme_ctx_t ctx, gpgme_data_t in, gpgme_data_t out, FILE* gpgfile,
void showpass(char* file) { void showpass(char* file) {
gpgme_ctx_t ctx; gpgme_ctx_t ctx;
gpgme_error_t err; gpgme_error_t err;
gpgme_data_t in, out; gpgme_data_t in = NULL, out = NULL;
FILE *gpgfile; FILE *gpgfile;
// GPGMEライブラリを設置 // GPGMEライブラリを設置
@ -52,7 +52,7 @@ void showpass(char* file) {
return; return;
} }
sprintf(gpgpath, "%s%s%s%s", homedir, basedir, file, ext); snprintf(gpgpath, alllen, "%s%s%s%s", homedir, basedir, file, ext);
gpgfile = fopen(gpgpath, "rb"); gpgfile = fopen(gpgpath, "rb");
if (gpgfile == NULL) { if (gpgfile == NULL) {
perror("ファイルを開くに失敗。"); perror("ファイルを開くに失敗。");
@ -61,7 +61,15 @@ void showpass(char* file) {
return; return;
} }
if (gpgme_data_new_from_stream(&in, gpgfile) != GPG_ERR_NO_ERROR || gpgme_data_new(&out) != GPG_ERR_NO_ERROR) { // ファイルからinデータオブジェクトを創作
if (gpgme_data_new_from_stream(&in, gpgfile) != GPG_ERR_NO_ERROR) {
fprintf(stderr, "GPGMEデータオブジェクトを創作に失敗。\n");
clean_up(ctx, in, out, gpgfile, gpgpath);
return;
}
// outデータオブジェクトを創作
if (gpgme_data_new(&out) != GPG_ERR_NO_ERROR) {
fprintf(stderr, "GPGMEデータオブジェクトを創作に失敗。\n"); fprintf(stderr, "GPGMEデータオブジェクトを創作に失敗。\n");
clean_up(ctx, in, out, gpgfile, gpgpath); clean_up(ctx, in, out, gpgfile, gpgpath);
return; return;

ファイルの表示

@ -52,7 +52,7 @@ void yankpass(char* file) {
return; return;
} }
sprintf(gpgpath, "%s%s%s%s", homedir, basedir, file, ext); snprintf(gpgpath, alllen, "%s%s%s%s", homedir, basedir, file, ext);
gpgfile = fopen(gpgpath, "rb"); gpgfile = fopen(gpgpath, "rb");
if (gpgfile == NULL) { if (gpgfile == NULL) {
perror("ファイルを開くに失敗。"); perror("ファイルを開くに失敗。");