Commit a5981ab0 authored by Benno Schulenberg's avatar Benno Schulenberg
Browse files

tweaks: don't close a descriptor when its stream has already been closed

No related merge requests found
Showing with 4 additions and 6 deletions
+4 -6
......@@ -704,13 +704,11 @@ int is_file_writable(const char *filename)
if ((fd = open(full_filename, O_WRONLY | O_CREAT | O_APPEND, S_IRUSR |
S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)) == -1)
result = FALSE;
else {
if ((f = fdopen(fd, "a")) == NULL)
result = FALSE;
else
fclose(f);
else if ((f = fdopen(fd, "a")) == NULL) {
result = FALSE;
close(fd);
}
} else
fclose(f);
free(full_filename);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment