/[hurd]/hurd/libdiskfs/file-chmod.c
ViewVC logotype

Diff of /hurd/libdiskfs/file-chmod.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.11 by tb, Mon Aug 10 17:42:35 1998 UTC revision 1.12 by roland, Fri Jan 4 01:46:48 2002 UTC
# Line 1  Line 1 
1  /* libdiskfs implementation of fs.defs: file_chmod  /* libdiskfs implementation of fs.defs: file_chmod
2     Copyright (C) 1992, 1993, 1994, 1996, 1997 Free Software Foundation     Copyright (C) 1992,93,94,96,97,2002 Free Software Foundation, Inc.
3    
4     This program is free software; you can redistribute it and/or     This program is free software; you can redistribute it and/or
5     modify it under the terms of the GNU General Public License as     modify it under the terms of the GNU General Public License as
# Line 23  diskfs_S_file_chmod (struct protid *cred Line 23  diskfs_S_file_chmod (struct protid *cred
23                mode_t mode)                mode_t mode)
24  {  {
25    mode &= ~(S_IFMT | S_ISPARE | S_ITRANS);    mode &= ~(S_IFMT | S_ISPARE | S_ITRANS);
26      
27    CHANGE_NODE_FIELD (cred,    CHANGE_NODE_FIELD (cred,
28                     ({                       ({
29                       if (!(err = fshelp_isowner (&np->dn_stat, cred->user)))                         if (!(err = fshelp_isowner (&np->dn_stat, cred->user)))
30                         {                           {
31                           if (!idvec_contains (cred->user->uids, 0))                             if (!idvec_contains (cred->user->uids, 0))
32                             {                               {
33                               if (!S_ISDIR (np->dn_stat.st_mode))                                 if (!S_ISDIR (np->dn_stat.st_mode))
34                                 mode &= ~S_ISVTX;                                   mode &= ~S_ISVTX;
35                               if (!idvec_contains (cred->user->gids,                                 if (!idvec_contains (cred->user->gids,
36                                                    np->dn_stat.st_gid))                                                      np->dn_stat.st_gid))
37                                 mode &= ~S_ISGID;                                   mode &= ~S_ISGID;
38                               if (!idvec_contains (cred->user->uids,                                 if (!idvec_contains (cred->user->uids,
39                                                    np->dn_stat.st_uid))                                                      np->dn_stat.st_uid))
40                                 mode &= ~S_ISUID;                                   mode &= ~S_ISUID;
41                             }                               }
42                           mode |= (np->dn_stat.st_mode & (S_IFMT | S_ISPARE));                             mode |= (np->dn_stat.st_mode
43                           err = diskfs_validate_mode_change (np, mode);                                      & (S_IFMT | S_ISPARE | S_ITRANS));
44                           if (!err)                             err = diskfs_validate_mode_change (np, mode);
45                             {                             if (!err)
46                               np->dn_stat.st_mode = mode;                               {
47                               np->dn_set_ctime = 1;                                 np->dn_stat.st_mode = mode;
48                               if (np->filemod_reqs)                                 np->dn_set_ctime = 1;
49                                 diskfs_notice_filechange(np,                                 if (np->filemod_reqs)
50                                                          FILE_CHANGED_META,                                   diskfs_notice_filechange (np,
51                                                          0, 0);                                                             FILE_CHANGED_META,
52                             }                                                             0, 0);
53                         }                               }
54                     }));                           }
55                         }));
56  }  }

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26