diff --git a/src/files.c b/src/files.c
index f1a4b93a83bd2b9dc4a0976d0ffd2cb5e224081b..4ba2e4e928682a15c4fe3a3e4da02c7fa39edddd 100644
--- a/src/files.c
+++ b/src/files.c
@@ -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);