diff options
author | Denys Vlasenko <dvlasenk@redhat.com> | 2010-08-31 12:42:06 +0200 |
---|---|---|
committer | Denys Vlasenko <dvlasenk@redhat.com> | 2010-08-31 12:42:06 +0200 |
commit | 8d3e225a2d1d980bcedb825f294b6a8041fe3f1b (patch) | |
tree | bfd632b8dbc3bb25c23aa437ebd0d2ea37818fe9 /util-linux | |
parent | 4e7dd3c363377aefd6ac60ab4335e773482bcca1 (diff) | |
download | busybox-w32-8d3e225a2d1d980bcedb825f294b6a8041fe3f1b.tar.gz busybox-w32-8d3e225a2d1d980bcedb825f294b6a8041fe3f1b.tar.bz2 busybox-w32-8d3e225a2d1d980bcedb825f294b6a8041fe3f1b.zip |
libbb: add xfstat function
function old new delta
xfstat - 25 +25
mkfs_ext2_main 2421 2423 +2
mkfs_reiser_main 1197 1194 -3
next 312 307 -5
ar_main 533 522 -11
mkfs_minix_main 2938 2924 -14
mkfs_vfat_main 1511 1495 -16
writeTarFile 272 255 -17
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/6 up/down: 27/-66) Total: -39 bytes
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'util-linux')
-rw-r--r-- | util-linux/mkfs_ext2.c | 2 | ||||
-rw-r--r-- | util-linux/mkfs_minix.c | 3 | ||||
-rw-r--r-- | util-linux/mkfs_reiser.c | 4 | ||||
-rw-r--r-- | util-linux/mkfs_vfat.c | 3 | ||||
-rw-r--r-- | util-linux/mkswap.c | 3 |
5 files changed, 6 insertions, 9 deletions
diff --git a/util-linux/mkfs_ext2.c b/util-linux/mkfs_ext2.c index 1c2b3b2e2..6dccd3a5d 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) | |||
221 | 221 | ||
222 | // open the device, check the device is a block device | 222 | // open the device, check the device is a block device |
223 | xmove_fd(xopen(argv[0], O_WRONLY), fd); | 223 | xmove_fd(xopen(argv[0], O_WRONLY), fd); |
224 | fstat(fd, &st); | 224 | xfstat(fd, &st, argv[0]); |
225 | if (!S_ISBLK(st.st_mode) && !(option_mask32 & OPT_F)) | 225 | if (!S_ISBLK(st.st_mode) && !(option_mask32 & OPT_F)) |
226 | bb_error_msg_and_die("%s: not a block device", argv[0]); | 226 | bb_error_msg_and_die("%s: not a block device", argv[0]); |
227 | 227 | ||
diff --git a/util-linux/mkfs_minix.c b/util-linux/mkfs_minix.c index 9e826aef3..95499ba17 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) | |||
686 | bb_error_msg_and_die("can't format mounted filesystem"); | 686 | bb_error_msg_and_die("can't format mounted filesystem"); |
687 | 687 | ||
688 | xmove_fd(xopen(G.device_name, O_RDWR), dev_fd); | 688 | xmove_fd(xopen(G.device_name, O_RDWR), dev_fd); |
689 | if (fstat(dev_fd, &statbuf) < 0) | 689 | xfstat(dev_fd, &statbuf, G.device_name); |
690 | bb_error_msg_and_die("can't stat '%s'", G.device_name); | ||
691 | if (!S_ISBLK(statbuf.st_mode)) | 690 | if (!S_ISBLK(statbuf.st_mode)) |
692 | opt &= ~1; // clear -c (check) | 691 | opt &= ~1; // clear -c (check) |
693 | 692 | ||
diff --git a/util-linux/mkfs_reiser.c b/util-linux/mkfs_reiser.c index 6e172d6d3..00ce8f1d1 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) | |||
168 | 168 | ||
169 | // check the device is a block device | 169 | // check the device is a block device |
170 | fd = xopen(argv[0], O_WRONLY | O_EXCL); | 170 | fd = xopen(argv[0], O_WRONLY | O_EXCL); |
171 | fstat(fd, &st); | 171 | xfstat(fd, &st, argv[0]); |
172 | if (!S_ISBLK(st.st_mode) && !(option_mask32 & OPT_f)) | 172 | if (!S_ISBLK(st.st_mode) && !(option_mask32 & OPT_f)) |
173 | bb_error_msg_and_die("not a block device"); | 173 | bb_error_msg_and_die("%s: not a block device", argv[0]); |
174 | 174 | ||
175 | // check if it is mounted | 175 | // check if it is mounted |
176 | // N.B. what if we format a file? find_mount_point will return false negative since | 176 | // 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 211e67e97..45760f7c5 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) | |||
245 | volume_id = time(NULL); | 245 | volume_id = time(NULL); |
246 | 246 | ||
247 | dev = xopen(device_name, O_RDWR); | 247 | dev = xopen(device_name, O_RDWR); |
248 | if (fstat(dev, &st) < 0) | 248 | xfstat(dev, &st, device_name); |
249 | bb_simple_perror_msg_and_die(device_name); | ||
250 | 249 | ||
251 | // | 250 | // |
252 | // Get image size and sector size | 251 | // Get image size and sector size |
diff --git a/util-linux/mkswap.c b/util-linux/mkswap.c index 61a786e92..53537fcd9 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) | |||
15 | if (!is_selinux_enabled()) | 15 | if (!is_selinux_enabled()) |
16 | return; | 16 | return; |
17 | 17 | ||
18 | if (fstat(fd, &stbuf) < 0) | 18 | xfstat(fd, &stbuf, argv[0]); |
19 | bb_perror_msg_and_die("fstat failed"); | ||
20 | if (S_ISREG(stbuf.st_mode)) { | 19 | if (S_ISREG(stbuf.st_mode)) { |
21 | security_context_t newcon; | 20 | security_context_t newcon; |
22 | security_context_t oldcon = NULL; | 21 | security_context_t oldcon = NULL; |