]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix movemail fd leak
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 15 May 2023 01:51:22 +0000 (18:51 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 15 May 2023 02:28:10 +0000 (19:28 -0700)
* lib-src/movemail.c (main) [!MAIL_USE_SYSTEM_LOCK]:
Fix file descriptor leak, found by GCC 13 -Wanalyzer-fd-leak.

lib-src/movemail.c

index a71be8c209943fd1729efca6b865192e9d9228cd..6a772e9043ed56aa6f54b3152a36f94940fa0fc1 100644 (file)
@@ -470,7 +470,7 @@ main (int argc, char **argv)
             that were set on the file.  Better to just empty the file.  */
          if (unlink (inname) < 0 && errno != ENOENT)
 #endif /* MAIL_UNLINK_SPOOL */
-           creat (inname, 0600);
+           close (creat (inname, 0600));
        }
 #endif /* not MAIL_USE_SYSTEM_LOCK */