diff options
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 | { |