summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDhaval Giani <dhaval@linux.vnet.ibm.com>2008-12-14 04:35:46 +0000
committerDhaval Giani <dhaval@linux.vnet.ibm.com>2008-12-14 04:35:46 +0000
commit7418f938a297167b464e4880c9c97d043c6f079e (patch)
tree492658d3ef3a0b423cb7308ccca0271201c50c52 /tests
parent96ee38b048031ceefcd8eb169fc1c4bd2bee2eb7 (diff)
downloadlibcg-7418f938a297167b464e4880c9c97d043c6f079e.zip
libcg-7418f938a297167b464e4880c9c97d043c6f079e.tar.gz
libcg-7418f938a297167b464e4880c9c97d043c6f079e.tar.xz
libcgroup: Segfault when we run setuid testcase without argument
From: "Rishikesh K. Rajak" <risrajak@linux.vnet.ibm.com> In libcgroup testcase "setuid" testcase segfault when we run without uid parameter. This patch fixes the issue. [dhaval@linux.vnet.ibm.com: Minor fixes] Signed-off-by: Rishikesh k Rajak <risrajak@linux.vnet.ibm.com> Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@235 4f4bb910-9a46-0410-90c8-c897d4f1cd53
Diffstat (limited to 'tests')
-rw-r--r--tests/setuid.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/setuid.c b/tests/setuid.c
index 9d77850..772de94 100644
--- a/tests/setuid.c
+++ b/tests/setuid.c
@@ -43,6 +43,11 @@ int main(int argc, char *argv[])
/* Return codes */
int ret;
+ if (argc < 2) {
+ printf("Usage: %s <uid_value> \n", argv[0]);
+ goto finished;
+ }
+
pwd = getpwnam(argv[1]);
uid = pwd->pw_uid;
fprintf(stdout, "Setting UID to %s (%d).\n", pwd->pw_name, uid);