stat: fix option -Z segv (bug 1454)

This commit is contained in:
Denis Vlasenko 2007-08-09 08:10:13 +00:00
parent 22a80d1e7d
commit 501bfe2630
2 changed files with 12 additions and 6 deletions

View File

@ -342,8 +342,11 @@ static bool do_statfs(char const *filename, char const *format)
security_context_t scontext = NULL; security_context_t scontext = NULL;
if (option_mask32 & OPT_SELINUX) { if (option_mask32 & OPT_SELINUX) {
if ((option_mask32 & OPT_DEREFERENCE ? lgetfilecon(filename, scontext): if ((option_mask32 & OPT_DEREFERENCE
getfilecon(filename, scontext))< 0) { ? lgetfilecon(filename, &scontext)
: getfilecon(filename, &scontext)
) < 0
) {
bb_perror_msg(filename); bb_perror_msg(filename);
return 0; return 0;
} }
@ -448,8 +451,11 @@ static bool do_stat(char const *filename, char const *format)
security_context_t scontext = NULL; security_context_t scontext = NULL;
if (option_mask32 & OPT_SELINUX) { if (option_mask32 & OPT_SELINUX) {
if ((option_mask32 & OPT_DEREFERENCE ? lgetfilecon(filename, scontext): if ((option_mask32 & OPT_DEREFERENCE
getfilecon(filename, scontext))< 0) { ? lgetfilecon(filename, &scontext)
: getfilecon(filename, &scontext)
) < 0
) {
bb_perror_msg(filename); bb_perror_msg(filename);
return 0; return 0;
} }