diff --git a/pam_yubico.c b/pam_yubico.c index c36ca0e..cb50bfc 100644 --- a/pam_yubico.c +++ b/pam_yubico.c @@ -819,7 +819,7 @@ parse_cfg (int flags, int argc, const char **argv, struct cfg *cfg) { if(S_ISREG(st.st_mode)) { - file = fopen(filename, "a"); + file = fopen(filename, "ae"); if(file) { cfg->debug_file = file; diff --git a/util.c b/util.c index 2112a58..d2cfc8d 100644 --- a/util.c +++ b/util.c @@ -188,7 +188,7 @@ int generate_random(void *buf, int len) FILE *u; int res; - u = fopen("/dev/urandom", "r"); + u = fopen("/dev/urandom", "re"); if (!u) { return -1; } diff --git a/ykpamcfg.c b/ykpamcfg.c index 16dbb86..cfc4cd0 100644 --- a/ykpamcfg.c +++ b/ykpamcfg.c @@ -237,7 +237,7 @@ do_add_hmac_chalresp(YK_KEY *yk, uint8_t slot, bool verbose, char *output_dir, u umask(077); - f = fopen (fn, "w"); + f = fopen (fn, "we"); if (! f) { fprintf (stderr, "Failed opening '%s' for writing : %s\n", fn, strerror (errno)); goto out;