Update of /cvsroot/libsysio/libsysio/tests
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5468/tests
Modified Files:
sysio_tests.c
Log Message:
Fixing up warnings
Removed getgrgid , getgrnam, getpwnam, and getpwuid from sysio_tests. This means
that chown ran from test_driver will now require numeric ids.
Index: sysio_tests.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/tests/sysio_tests.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -w -b -B -p -r1.8 -r1.9
--- sysio_tests.c 12 Apr 2004 19:31:36 -0000 1.8
+++ sysio_tests.c 14 Apr 2004 18:46:25 -0000 1.9
@@ -13,9 +13,6 @@
#include <sys/queue.h>
#include <dirent.h>
-#include <pwd.h>
-#include <grp.h>
-
#include "sysio.h"
#include "mount.h"
#include "test.h"
@@ -31,7 +28,6 @@
*/
int initilize_sysio()
{
- int err;
char *wd;
/*
@@ -438,8 +434,6 @@ int sysio_chown(char *new_id, char *file
{
char *owner = NULL;
char *group = NULL;
- struct group *g_ent = NULL;
- struct passwd *o_ent = NULL;
uid_t o_id=-1, g_id=-1;
int len, j, i=0;
int state = 0; /* Correspond to getting owner name */
@@ -479,19 +473,12 @@ int sysio_chown(char *new_id, char *file
/* Numeric -- just convert */
o_id = (uid_t) atoi(owner);
- /* Make sure it is valid */
- if ((o_ent = getpwuid(o_id)) == NULL) {
- DBG(2, sprintf(output, "Error: uid %d not found \n", o_id));
- return INVALID_ARGS;
- }
} else {
- /* Get the id from the passwd file */
- if ((o_ent = getpwnam(owner)) == NULL) {
- DBG(2, sprintf(output, "Error: name %s not found\n", owner));
+ /* No longer support non-numeric ids */
+
+ DBG(2, sprintf(output, "Error: non-numeric ids unsupported\n"));
return INVALID_ARGS;
}
- o_id = o_ent->pw_uid;
- }
}
@@ -500,20 +487,11 @@ int sysio_chown(char *new_id, char *file
if (isdigit(group[0])) {
/* Numeric -- just convert */
g_id = (uid_t) atoi(group);
-
- /* Make sure it is valid */
- if ((g_ent = getgrgid(g_id)) == NULL) {
- DBG(2, sprintf(output, "Error: gid %d not found \n", g_id));
- return INVALID_ARGS;
- }
} else {
- /* Find group in group file */
- if ((g_ent = getgrnam(group)) == NULL) {
- DBG(2, sprintf(output, "Error: group %s not found \n", group));
+ /* Don't support group names either */
+ DBG(2, sprintf(output, "Error: non-numeric ids unsupported\n"));
return INVALID_ARGS;
}
- g_id = g_ent->gr_gid;
- }
}
/* Now issue the syscall */
|