public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Sandeep Patil <sspatil@google.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 3/5] syscalls/fchmod02: fall back to use "daemon" group if "users" is absent.
Date: Mon,  5 Nov 2018 15:50:17 -0800	[thread overview]
Message-ID: <20181105235019.254846-4-sspatil@google.com> (raw)
In-Reply-To: <20181105235019.254846-1-sspatil@google.com>

This makes the test work successfully on Android systems where
"users" group doesn't exist.

Signed-off-by: Sandeep Patil <sspatil@google.com>
---
 testcases/kernel/syscalls/fchmod/fchmod02.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/testcases/kernel/syscalls/fchmod/fchmod02.c b/testcases/kernel/syscalls/fchmod/fchmod02.c
index d0b35db12..e60cb33a6 100644
--- a/testcases/kernel/syscalls/fchmod/fchmod02.c
+++ b/testcases/kernel/syscalls/fchmod/fchmod02.c
@@ -22,9 +22,6 @@
 #include "tst_test.h"
 #include "fchmod.h"
 
-#define LTPUSER		"nobody"
-#define LTPGRP		"users"
-
 static int fd;
 
 static void verify_fchmod(void)
@@ -53,8 +50,8 @@ static void setup(void)
 	struct passwd *ltpuser;
 	struct group *ltpgroup;
 
-	ltpuser = SAFE_GETPWNAM(LTPUSER);
-	ltpgroup = SAFE_GETGRNAM(LTPGRP);
+	ltpuser = SAFE_GETPWNAM("nobody");
+	ltpgroup = SAFE_GETGRNAM_FALLBACK("users", "daemon");
 
 	fd = SAFE_OPEN(TESTFILE, O_RDWR | O_CREAT, FILE_MODE);
 	SAFE_CHOWN(TESTFILE, ltpuser->pw_uid, ltpgroup->gr_gid);
-- 
2.19.1.930.g4563a0d9d0-goog


  parent reply	other threads:[~2018-11-05 23:50 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-05 23:50 [LTP] [PATCH 0/5] Misc cleanups (new lib) and fixes for Android Sandeep Patil
2018-11-05 23:50 ` [LTP] [PATCH 1/5] chroot01: Use the 'tmpdir' we create Sandeep Patil
2018-11-06 15:45   ` Cyril Hrubis
2018-11-05 23:50 ` [LTP] [PATCH 2/5] syscalls/chmod07: Use new ltp library Sandeep Patil
2018-11-06 15:46   ` Cyril Hrubis
2018-11-05 23:50 ` Sandeep Patil [this message]
2018-11-06 16:02   ` [LTP] [PATCH 3/5] syscalls/fchmod02: fall back to use "daemon" group if "users" is absent Cyril Hrubis
2018-11-05 23:50 ` [LTP] [PATCH 4/5] syscalls/chmod05: Use new ltp library Sandeep Patil
2018-11-06 15:55   ` Sandeep Patil
2018-11-06 16:01     ` Cyril Hrubis
2018-11-06 16:13       ` Sandeep Patil
2018-11-05 23:50 ` [LTP] [PATCH 5/5] syscalls/posix_fadvise0[13]: Start using new library Sandeep Patil
2018-11-06  7:00   ` Amir Goldstein
2018-11-06 15:52     ` Sandeep Patil
2018-11-06 15:54     ` Cyril Hrubis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181105235019.254846-4-sspatil@google.com \
    --to=sspatil@google.com \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox