Skip to content

Commit

Permalink
tests: don't symbolize root uid / gid in extfs tests (if run as root)
Browse files Browse the repository at this point in the history
Signed-off-by: Yury V. Zaytsev <[email protected]>
  • Loading branch information
zyv committed Oct 19, 2024
1 parent e0fa1d7 commit ae88525
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/src/vfs/extfs/helpers-list/mc_parse_ls_l.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,15 +161,17 @@ my_itoa (int i)
static const char *
symbolic_uid (uid_t uid)
{
return (opt_symbolic_ids && uid == getuid ())? "<<uid>>" : my_itoa ((int) uid);
const uid_t user_uid = getuid();
return (opt_symbolic_ids && uid == user_uid && user_uid != 0)? "<<uid>>" : my_itoa ((int) uid);
}

/* --------------------------------------------------------------------------------------------- */

static const char *
symbolic_gid (gid_t gid)
{
return (opt_symbolic_ids && gid == getgid ())? "<<gid>>" : my_itoa ((int) gid);
const gid_t user_gid = getgid ();
return (opt_symbolic_ids && gid == user_gid && user_gid != 0)? "<<gid>>" : my_itoa ((int) gid);
}

/* --------------------------------------------------------------------------------------------- */
Expand Down

0 comments on commit ae88525

Please sign in to comment.