Thread View: gnu.utils.bug
1 messages
1 total messages
Started by Mike Rendell
Sat, 31 Oct 1992 12:19
Bug in chown [fileutils 3.3], +fix
Author: Mike Rendell
Date: Sat, 31 Oct 1992 12:19
Date: Sat, 31 Oct 1992 12:19
98 lines
3119 bytes
3119 bytes
Environment: Mips M/120 running Riscos/5.00 using Mips 3.0 compilers
and Sun SparcStation 2 running SunOS 4.1.x using gcc 2.2.2
Chown does not work on (at least some) machines that have non-`int'
uid_t and gid_t types (e.g., ones where uid_t is an unsigned short).
This is because parse_user_spec() expects pointers to [ud]id_t's but is
passed pointers to int's. The following diff fixes chown.c to use the
correct types when dealing with uids and gids.
[BTW: The diff I recently sent for dd.c is backwards (i.e., generated
by diff -c newfile oldfile).]
*** chown.c.orig Sat Oct 31 15:49:53 1992
--- chown.c Sat Oct 31 15:49:42 1992
***************
*** 96,103 ****
int argc;
char **argv;
{
! int user = -1; /* New uid; -1 if not to be changed. */
! int group = -1; /* New gid; -1 if not to be changed. */
int errors = 0;
int optc;
char *e;
--- 96,103 ----
int argc;
char **argv;
{
! uid_t user = (uid_t) -1; /* New uid; -1 if not to be changed. */
! gid_t group = (gid_t) -1; /* New gid; -1 if not to be changed. */
int errors = 0;
int optc;
char *e;
***************
*** 150,159 ****
int
change_file_owner (file, user, group)
char *file;
! int user, group;
{
struct stat file_stats;
! int newuser, newgroup;
int errors = 0;
if (lstat (file, &file_stats))
--- 150,161 ----
int
change_file_owner (file, user, group)
char *file;
! uid_t user;
! gid_t group;
{
struct stat file_stats;
! uid_t newuser;
! gid_t newgroup;
int errors = 0;
if (lstat (file, &file_stats))
***************
*** 163,170 ****
return 1;
}
! newuser = user == -1 ? file_stats.st_uid : user;
! newgroup = group == -1 ? file_stats.st_gid : group;
if (newuser != file_stats.st_uid || newgroup != file_stats.st_gid)
{
if (verbose)
--- 165,172 ----
return 1;
}
! newuser = user == (uid_t) -1 ? file_stats.st_uid : user;
! newgroup = group == (gid_t) -1 ? file_stats.st_gid : group;
if (newuser != file_stats.st_uid || newgroup != file_stats.st_gid)
{
if (verbose)
***************
*** 192,198 ****
int
change_dir_owner (dir, user, group, statp)
char *dir;
! int user, group;
struct stat *statp;
{
char *name_space, *namep;
--- 194,201 ----
int
change_dir_owner (dir, user, group, statp)
char *dir;
! uid_t user;
! gid_t group;
struct stat *statp;
{
char *name_space, *namep;
--
Michael Rendell - Dept. of Comp. Sci., Memorial University of Newfoundland
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads