Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 5 Jan 2018 05:34:15 +0000 (UTC)
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r327570 - head/sbin/newfs_msdos
Message-ID:  <201801050534.w055YFQx093403@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: imp
Date: Fri Jan  5 05:34:14 2018
New Revision: 327570
URL: https://svnweb.freebsd.org/changeset/base/327570

Log:
  Only call close if fd and fd1 are not -1.
  
  CID: 1384018, 1384017

Modified:
  head/sbin/newfs_msdos/mkfs_msdos.c

Modified: head/sbin/newfs_msdos/mkfs_msdos.c
==============================================================================
--- head/sbin/newfs_msdos/mkfs_msdos.c	Fri Jan  5 05:02:09 2018	(r327569)
+++ head/sbin/newfs_msdos/mkfs_msdos.c	Fri Jan  5 05:34:14 2018	(r327570)
@@ -717,8 +717,10 @@ mkfs_msdos(const char *fname, const char *dtype, const
     rv = 0;
 done:
     free(img);
-    close(fd);
-    close(fd1);
+    if (fd != -1)
+	    close(fd);
+    if (fd1 != -1)
+	    close(fd1);
 
     return rv;
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201801050534.w055YFQx093403>