util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Davidlohr Bueso <dave@gnu.org>
To: Karel Zak <kzak@redhat.com>
Cc: util-linux <util-linux@vger.kernel.org>
Subject: [PATCH 2/2] sfdisk: use is_blkdev
Date: Thu, 05 Jan 2012 00:02:11 +0100	[thread overview]
Message-ID: <1325718131.7056.6.camel@offbook> (raw)

From: Davidlohr Bueso <dave@gnu.org>

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
---
 fdisk/sfdisk.c |    9 +--------
 1 files changed, 1 insertions(+), 8 deletions(-)

diff --git a/fdisk/sfdisk.c b/fdisk/sfdisk.c
index 469e87f..70a5e2a 100644
--- a/fdisk/sfdisk.c
+++ b/fdisk/sfdisk.c
@@ -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"));
-- 
1.7.4.1





             reply	other threads:[~2012-01-04 23:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-04 23:02 Davidlohr Bueso [this message]
2012-01-04 23:02 ` [PATCH 1/2] blkdev: add is_blkdev function Davidlohr Bueso
2012-01-04 22:28   ` [PATCH] lscpu: fix compiler warnings Davidlohr Bueso
     [not found]     ` <1324994959-24298-1-git-send-email-gaowanlong@cn.fujitsu.com>
2011-12-20 13:42       ` [PATCH 4/5] fdisk: remove packed definitions Davidlohr Bueso
2011-12-20 13:42         ` [PATCH 3/5] sfdisk: do not depend on arch for packed attribute Davidlohr Bueso
2012-01-05 16:29           ` Karel Zak
2011-12-22  2:33         ` [PATCH 4/5] fdisk: remove packed definitions Guillem Jover
2012-01-05 16:30     ` [PATCH] lscpu: fix compiler warnings Karel Zak
2012-01-05 16:31   ` [PATCH 1/2] blkdev: add is_blkdev function Karel Zak
2012-01-05 16:31 ` [PATCH 2/2] sfdisk: use is_blkdev Karel Zak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1325718131.7056.6.camel@offbook \
    --to=dave@gnu.org \
    --cc=kzak@redhat.com \
    --cc=util-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).