summaryrefslogtreecommitdiff
path: root/util-linux
diff options
context:
space:
mode:
Diffstat (limited to 'util-linux')
-rw-r--r--util-linux/mkfs_ext2.c2
-rw-r--r--util-linux/mkfs_minix.c3
-rw-r--r--util-linux/mkfs_reiser.c4
-rw-r--r--util-linux/mkfs_vfat.c3
-rw-r--r--util-linux/mkswap.c3
5 files changed, 6 insertions, 9 deletions
diff --git a/util-linux/mkfs_ext2.c b/util-linux/mkfs_ext2.c
index 1c2b3b2..6dccd3a 100644
--- a/util-linux/mkfs_ext2.c
+++ b/util-linux/mkfs_ext2.c
@@ -221,7 +221,7 @@ int mkfs_ext2_main(int argc UNUSED_PARAM, char **argv)
// open the device, check the device is a block device
xmove_fd(xopen(argv[0], O_WRONLY), fd);
- fstat(fd, &st);
+ xfstat(fd, &st, argv[0]);
if (!S_ISBLK(st.st_mode) && !(option_mask32 & OPT_F))
bb_error_msg_and_die("%s: not a block device", argv[0]);
diff --git a/util-linux/mkfs_minix.c b/util-linux/mkfs_minix.c
index 9e826ae..95499ba 100644
--- a/util-linux/mkfs_minix.c
+++ b/util-linux/mkfs_minix.c
@@ -686,8 +686,7 @@ int mkfs_minix_main(int argc UNUSED_PARAM, char **argv)
bb_error_msg_and_die("can't format mounted filesystem");
xmove_fd(xopen(G.device_name, O_RDWR), dev_fd);
- if (fstat(dev_fd, &statbuf) < 0)
- bb_error_msg_and_die("can't stat '%s'", G.device_name);
+ xfstat(dev_fd, &statbuf, G.device_name);
if (!S_ISBLK(statbuf.st_mode))
opt &= ~1; // clear -c (check)
diff --git a/util-linux/mkfs_reiser.c b/util-linux/mkfs_reiser.c
index 6e172d6..00ce8f1 100644
--- a/util-linux/mkfs_reiser.c
+++ b/util-linux/mkfs_reiser.c
@@ -168,9 +168,9 @@ int mkfs_reiser_main(int argc UNUSED_PARAM, char **argv)
// check the device is a block device
fd = xopen(argv[0], O_WRONLY | O_EXCL);
- fstat(fd, &st);
+ xfstat(fd, &st, argv[0]);
if (!S_ISBLK(st.st_mode) && !(option_mask32 & OPT_f))
- bb_error_msg_and_die("not a block device");
+ bb_error_msg_and_die("%s: not a block device", argv[0]);
// check if it is mounted
// N.B. what if we format a file? find_mount_point will return false negative since
diff --git a/util-linux/mkfs_vfat.c b/util-linux/mkfs_vfat.c
index 211e67e..45760f7 100644
--- a/util-linux/mkfs_vfat.c
+++ b/util-linux/mkfs_vfat.c
@@ -245,8 +245,7 @@ int mkfs_vfat_main(int argc UNUSED_PARAM, char **argv)
volume_id = time(NULL);
dev = xopen(device_name, O_RDWR);
- if (fstat(dev, &st) < 0)
- bb_simple_perror_msg_and_die(device_name);
+ xfstat(dev, &st, device_name);
//
// Get image size and sector size
diff --git a/util-linux/mkswap.c b/util-linux/mkswap.c
index 61a786e..53537fc 100644
--- a/util-linux/mkswap.c
+++ b/util-linux/mkswap.c
@@ -15,8 +15,7 @@ static void mkswap_selinux_setcontext(int fd, const char *path)
if (!is_selinux_enabled())
return;
- if (fstat(fd, &stbuf) < 0)
- bb_perror_msg_and_die("fstat failed");
+ xfstat(fd, &stbuf, argv[0]);
if (S_ISREG(stbuf.st_mode)) {
security_context_t newcon;
security_context_t oldcon = NULL;