X-Git-Url: https://tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Ftincctl.c;h=00757c47a57b96d7c3f258acd92652be66e9cac1;hp=c9d8c67c98e3ed6a91ad8c48008ace6af1119f4d;hb=d8d1ab4ee1e92ec84fe9ea86eec2396275483a92;hpb=ab0576a2034b03f92943ac477e4e97731a899554 diff --git a/src/tincctl.c b/src/tincctl.c index c9d8c67c..00757c47 100644 --- a/src/tincctl.c +++ b/src/tincctl.c @@ -233,6 +233,12 @@ FILE *fopenmask(const char *filename, const char *mode, mode_t perms) { perms &= ~mask; umask(~perms); FILE *f = fopen(filename, mode); + + if(!f) { + fprintf(stderr, "Could not open %s: %s\n", filename, strerror(errno)); + return NULL; + } + #ifdef HAVE_FCHMOD if((perms & 0444) && f) fchmod(fileno(f), perms);