Re: [PATCH 2/2] mkfs.xfs: prevent close(-1) on protofile error path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



My previous cleanups introduced this; in the case where
fd=open() failed, the out_fail: path would try to close(-1).

Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx>
---

diff --git a/mkfs/proto.c b/mkfs/proto.c
index 308325b..5a47e27 100644
--- a/mkfs/proto.c
+++ b/mkfs/proto.c
@@ -84,7 +84,8 @@ setup_proto(
 	return buf;
 
 out_fail:
-	close(fd);
+	if (fd >= 0)
+		close(fd);
 	free(buf);
 	exit(1);
 }

_______________________________________________
xfs mailing list
xfs@xxxxxxxxxxx
http://oss.sgi.com/mailman/listinfo/xfs




[Index of Archives]     [Linux XFS Devel]     [Linux Filesystem Development]     [Filesystem Testing]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux