From 501bfe2630054f9988e08a5d77e1b1ff2abc78bb Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Thu, 9 Aug 2007 08:10:13 +0000 Subject: stat: fix option -Z segv (bug 1454) --- coreutils/stat.c | 16 +++++++++++----- libbb/make_directory.c | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/coreutils/stat.c b/coreutils/stat.c index 9930d847d..7c72127c5 100644 --- a/coreutils/stat.c +++ b/coreutils/stat.c @@ -342,8 +342,11 @@ static bool do_statfs(char const *filename, char const *format) security_context_t scontext = NULL; if (option_mask32 & OPT_SELINUX) { - if ((option_mask32 & OPT_DEREFERENCE ? lgetfilecon(filename, scontext): - getfilecon(filename, scontext))< 0) { + if ((option_mask32 & OPT_DEREFERENCE + ? lgetfilecon(filename, &scontext) + : getfilecon(filename, &scontext) + ) < 0 + ) { bb_perror_msg(filename); return 0; } @@ -448,9 +451,12 @@ static bool do_stat(char const *filename, char const *format) security_context_t scontext = NULL; if (option_mask32 & OPT_SELINUX) { - if ((option_mask32 & OPT_DEREFERENCE ? lgetfilecon(filename, scontext): - getfilecon(filename, scontext))< 0) { - bb_perror_msg (filename); + if ((option_mask32 & OPT_DEREFERENCE + ? lgetfilecon(filename, &scontext) + : getfilecon(filename, &scontext) + ) < 0 + ) { + bb_perror_msg(filename); return 0; } } diff --git a/libbb/make_directory.c b/libbb/make_directory.c index d540ad133..8841c95d3 100644 --- a/libbb/make_directory.c +++ b/libbb/make_directory.c @@ -98,6 +98,6 @@ int bb_make_directory (char *path, long mode, int flags) } while (1); - bb_perror_msg ("cannot %s directory '%s'", fail_msg, path); + bb_perror_msg("cannot %s directory '%s'", fail_msg, path); return -1; } -- cgit v1.2.3