[prev in list] [next in list] [prev in thread] [next in thread]
List: dm-devel
Subject: [dm-devel] [PATCH] dmsetup: detect write failure
From: Jim Meyering <jim () meyering ! net>
Date: 2007-03-12 14:25:10
Message-ID: 87abyipmih.fsf () rho ! meyering ! net
[Download RAW message or body]
Since "fd" may be open on a writable file handle, it's
important to test for close failure. Otherwise, the code
could fail to detect a write error.
2007-03-11 Jim Meyering <meyering@redhat.com>
* dmsetup/dmsetup.c (_loop_table): Detect close failure.
Index: dmsetup/dmsetup.c
===================================================================
RCS file: /cvs/dm/device-mapper/dmsetup/dmsetup.c,v
retrieving revision 1.87
diff -u -p -r1.87 dmsetup.c
--- dmsetup/dmsetup.c 14 Feb 2007 15:12:16 -0000 1.87
+++ dmsetup/dmsetup.c 12 Mar 2007 14:16:47 -0000
@@ -1920,7 +1920,10 @@ static int _loop_table(char *table, size
blksize = fsbuf.f_frsize;
#endif
- close(fd);
+ if (close(fd)) {
+ fd = -1;
+ goto error;
+ }
if (dm_snprintf(table, tlen, "%llu %llu loop %s %llu\n", 0ULL,
(long long unsigned)sectors, file, off) < 0)
--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic