Fix logic goof when checking open() status.

This commit is contained in:
Todd C. Miller
2013-09-03 11:24:31 -06:00
parent 13fd13e17c
commit 6b57ef4f6d

View File

@@ -487,7 +487,7 @@ write_info_log(char *pathbuf, size_t len, struct iolog_details *details,
pathbuf[len] = '\0';
strlcat(pathbuf, "/log", PATH_MAX);
fd = open(pathbuf, O_CREAT|O_WRONLY, S_IRUSR|S_IWUSR);
if (fd != -1 || (fp = fdopen(fd, "w")) == NULL)
if (fd == -1 || (fp = fdopen(fd, "w")) == NULL)
log_fatal(USE_ERRNO, N_("unable to create %s"), pathbuf);
fprintf(fp, "%lld:%s:%s:%s:%s:%d:%d\n%s\n%s", (long long)now->tv_sec,