Article View: gnu.utils.bug
Article #230Re: fileutils 3.3 (chown.c fix)
From: Glaze
Date: Sat, 08 Aug 1992 15:52
Date: Sat, 08 Aug 1992 15:52
86 lines
2814 bytes
2814 bytes
cattelan@everest.ee.umn.edu (Russell Cattelan) writes:
>I found that with fileutils 3.3 chown stoped working, well with a
>little hacking I found that the types for user and group were declared
>as "int" rather than uid_t and gid_t, thus the values set by
>parse_user_spec() were misaligned.
>Sooooo here is the simple fix.
[mini patch given]
>Also chown on the SGI's is giving me this error message.
>chown: ./cp.h: Invalid argument
>I haven't figured this one out yet
It's the same problem. You didn't complete the patching of the variable
type defs. You need to change them all. Also, for some reason I had to
put (uid_t) and (gid_t) casting for the -1. Seems strange that the
compiler would try to compare a u_short (type of uid_t/gid_t) with a
long. Here's a full (I think) patch:
*** chown.c Fri Aug 7 09:41:10 1992
--- chown.new Fri Aug 7 09:43:10 1992
***************
*** 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;
Technical Details
Message-ID:
<glaze.9146@glaze>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cs.mu.oz.AU!glazeReferences:
<199208041515.AA22489@everest.ee.umn.edu>Show Full Headers
Complete Article Headers
Newsgroups: gnu.utils.bug Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cs.mu.oz.AU!glaze From: glaze@cs.mu.oz.AU (Glaze) Subject: Re: fileutils 3.3 (chown.c fix) Message-ID: <glaze.9146@glaze> Sender: gnulists@ai.mit.edu Organization: Computer Science, University of Melbourne, Australia References: <199208041515.AA22489@everest.ee.umn.edu> Distribution: gnu Date: Sat, 8 Aug 1992 15:52:26 GMT Approved: bug-gnu-utils@prep.ai.mit.edu Lines: 87