Bug in 2.6.1

Gordon Lack gml4410 at ggr.co.uk
Wed Apr 28 14:36:20 GMT 2004

    I'm not sure what the code is trying to do, but the SGI Irix 
compiler spotted  this usage of an undefined variable.

    In uidlist.c:

static int map_uid(int id, char *name)
	uid_t uid;
	if (uid != 0 && name_to_uid(name, &uid))
		return uid;
	return id;

static int map_gid(int id, char *name)
	gid_t gid;
	if (gid != 0 && name_to_gid(name, &gid))
		return gid;
	return id;

    Both uid (in map_uid) and gid (in map_gid) are used (tested against 
0) without being defined.

    If these are dynamic variables they should be initilaized first, but 
then that makes the check superfluous, as you will just have set it so 
*know* the value.

    Are these supposed to be static variables?  That would mean that 
these functions are always expecting to be called with the same value of 
name.  Not sure this is likely, giving that the calling context refers 
to "list of uids".

More information about the rsync mailing list