Skip to contentSkip to conversation

sfdisk: use is_blkdev

PATCH Applied Davidlohr Bueso 2 participants 3 messages Jan 4, 2012 – Jan 5, 2012 Util-Linux package

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 sfdisk: use is_blkdev

From: Davidlohr Bueso <[email protected]>

---
 fdisk/sfdisk.c |    9 +--------
 1 files changed, 1 insertions(+), 8 deletions(-)
fdisk/sfdisk.c +1 -8
index 469e87f..70a5e2a 100644
@@ -794,13 +794,6 @@ reread_ioctl(int fd) {
     return 0;
 }
 
-static int
-is_blockdev(int fd) {
-    struct stat statbuf;
-
-    return (fstat(fd, &statbuf) == 0 && S_ISBLK(statbuf.st_mode));
-}
-
 /* reread after writing */
 static int
 reread_disk_partition(char *dev, int fd) {
@@ -808,7 +801,7 @@ reread_disk_partition(char *dev, int fd) {
     fflush(stdout);
     sync();
 
-    if (reread_ioctl(fd) && is_blockdev(fd)) {
+    if (reread_ioctl(fd) && is_blkdev(fd)) {
 	do_warn(_("The command to re-read the partition table failed.\n"
 		  "Run partprobe(8), kpartx(8) or reboot your system now,\n"
 		  "before using mkfs\n"));
Signature · 1 line
1.7.4.1
maintainer
#1 lore raw

Re: [PATCH 3/5] sfdisk: do not depend on arch for packed attribute

Quoted 3 lines · Davidlohr Bueso
 fdisk/sfdisk.c |    9 ---------
 include/c.h    |    3 +++
 2 files changed, 3 insertions(+), 9 deletions(-)
Quoted 2 lines · Davidlohr Bueso
 fdisk/fdisk.h |    6 ------
 1 files changed, 0 insertions(+), 6 deletions(-)

I have removed the PACKED macro at all and used __attribute__ keyword in the code.

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com