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 /libbb/xfuncs_printf.c | |
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 'libbb/xfuncs_printf.c')
-rw-r--r-- | libbb/xfuncs_printf.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libbb/xfuncs_printf.c b/libbb/xfuncs_printf.c index b99f906df..c6db38d33 100644 --- a/libbb/xfuncs_printf.c +++ b/libbb/xfuncs_printf.c | |||
@@ -436,6 +436,16 @@ void FAST_FUNC xstat(const char *name, struct stat *stat_buf) | |||
436 | bb_perror_msg_and_die("can't stat '%s'", name); | 436 | bb_perror_msg_and_die("can't stat '%s'", name); |
437 | } | 437 | } |
438 | 438 | ||
439 | void FAST_FUNC xfstat(int fd, struct stat *stat_buf, const char *errmsg) | ||
440 | { | ||
441 | /* errmsg is usually a file name, but not always: | ||
442 | * xfstat may be called in a spot where file name is no longer | ||
443 | * available, and caller may give e.g. "can't stat input file" string. | ||
444 | */ | ||
445 | if (fstat(fd, stat_buf)) | ||
446 | bb_simple_perror_msg_and_die(errmsg); | ||
447 | } | ||
448 | |||
439 | // selinux_or_die() - die if SELinux is disabled. | 449 | // selinux_or_die() - die if SELinux is disabled. |
440 | void FAST_FUNC selinux_or_die(void) | 450 | void FAST_FUNC selinux_or_die(void) |
441 | { | 451 | { |