diff --git a/main.c b/main.c index 5e9ec202..769182f1 100644 --- a/main.c +++ b/main.c @@ -387,12 +387,13 @@ FILE * settings_open_for_write(const char *name) { FILE *fp; - int fd; - if((fd = open(name, O_CREAT | O_TRUNC | O_RDWR, 0600)) < 0) + if((fd = open(name, O_CREAT | O_TRUNC | O_RDWR, 0600)) < 0) { syslog(LOG_ALERT, "Unable to open settings file \"%s\" -- %s", name, strerror(errno)); + return NULL; + } if((fp = fdopen(fd, "w+")) == NULL) syslog(LOG_ALERT, "Unable to open settings file \"%s\" -- %s",