From 6b57ef4f6da3b7798043a6ea26e28fa8f45d1e05 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Tue, 3 Sep 2013 11:24:31 -0600 Subject: [PATCH] Fix logic goof when checking open() status. --- plugins/sudoers/iolog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/sudoers/iolog.c b/plugins/sudoers/iolog.c index 57b2026b4..6dc8a2634 100644 --- a/plugins/sudoers/iolog.c +++ b/plugins/sudoers/iolog.c @@ -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,