diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 9 | ||||
| -rw-r--r-- | src/dired.c | 18 | ||||
| -rw-r--r-- | src/editfns.c | 20 |
3 files changed, 31 insertions, 16 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index a35c51b8555..ff80763f351 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,12 @@ | |||
| 1 | 2012-12-14 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | Fix permissions bugs with setgid directories etc. (Bug#13125) | ||
| 4 | * dired.c (Ffile_attributes): Return t as the 9th attribute, | ||
| 5 | to mark it as a placeholder. The old value was often wrong. | ||
| 6 | The only user of this attribute has been changed to use | ||
| 7 | file-ownership-preserved-p instead, with its new group arg. | ||
| 8 | * editfns.c (Fgroup_gid, Fgroup_real_gid): New functions. | ||
| 9 | |||
| 1 | 2012-12-14 Stefan Monnier <monnier@iro.umontreal.ca> | 10 | 2012-12-14 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 11 | ||
| 3 | * xdisp.c (select_frame_for_redisplay, display_mode_lines): | 12 | * xdisp.c (select_frame_for_redisplay, display_mode_lines): |
diff --git a/src/dired.c b/src/dired.c index 85af906c1da..1fda9e8b371 100644 --- a/src/dired.c +++ b/src/dired.c | |||
| @@ -869,7 +869,7 @@ Elements of the attribute list are: | |||
| 869 | 7. Size in bytes. | 869 | 7. Size in bytes. |
| 870 | This is a floating point number if the size is too large for an integer. | 870 | This is a floating point number if the size is too large for an integer. |
| 871 | 8. File modes, as a string of ten letters or dashes as in ls -l. | 871 | 8. File modes, as a string of ten letters or dashes as in ls -l. |
| 872 | 9. t if file's gid would change if file were deleted and recreated. | 872 | 9. An unspecified value, present only for backward compatibility. |
| 873 | 10. inode number. If it is larger than what an Emacs integer can hold, | 873 | 10. inode number. If it is larger than what an Emacs integer can hold, |
| 874 | this is of the form (HIGH . LOW): first the high bits, then the low 16 bits. | 874 | this is of the form (HIGH . LOW): first the high bits, then the low 16 bits. |
| 875 | If even HIGH is too large for an Emacs integer, this is instead of the form | 875 | If even HIGH is too large for an Emacs integer, this is instead of the form |
| @@ -891,10 +891,6 @@ so last access time will always be midnight of that day. */) | |||
| 891 | Lisp_Object values[12]; | 891 | Lisp_Object values[12]; |
| 892 | Lisp_Object encoded; | 892 | Lisp_Object encoded; |
| 893 | struct stat s; | 893 | struct stat s; |
| 894 | #ifdef BSD4_2 | ||
| 895 | Lisp_Object dirname; | ||
| 896 | struct stat sdir; | ||
| 897 | #endif /* BSD4_2 */ | ||
| 898 | int lstat_result; | 894 | int lstat_result; |
| 899 | 895 | ||
| 900 | /* An array to hold the mode string generated by filemodestring, | 896 | /* An array to hold the mode string generated by filemodestring, |
| @@ -974,17 +970,7 @@ so last access time will always be midnight of that day. */) | |||
| 974 | 970 | ||
| 975 | filemodestring (&s, modes); | 971 | filemodestring (&s, modes); |
| 976 | values[8] = make_string (modes, 10); | 972 | values[8] = make_string (modes, 10); |
| 977 | #ifdef BSD4_2 /* file gid will be dir gid */ | 973 | values[9] = Qt; |
| 978 | dirname = Ffile_name_directory (filename); | ||
| 979 | if (! NILP (dirname)) | ||
| 980 | encoded = ENCODE_FILE (dirname); | ||
| 981 | if (! NILP (dirname) && stat (SDATA (encoded), &sdir) == 0) | ||
| 982 | values[9] = (sdir.st_gid != s.st_gid) ? Qt : Qnil; | ||
| 983 | else /* if we can't tell, assume worst */ | ||
| 984 | values[9] = Qt; | ||
| 985 | #else /* file gid will be egid */ | ||
| 986 | values[9] = (s.st_gid != getegid ()) ? Qt : Qnil; | ||
| 987 | #endif /* not BSD4_2 */ | ||
| 988 | values[10] = INTEGER_TO_CONS (s.st_ino); | 974 | values[10] = INTEGER_TO_CONS (s.st_ino); |
| 989 | values[11] = INTEGER_TO_CONS (s.st_dev); | 975 | values[11] = INTEGER_TO_CONS (s.st_dev); |
| 990 | 976 | ||
diff --git a/src/editfns.c b/src/editfns.c index eb909f73697..108c8b27187 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -1272,6 +1272,24 @@ Value is an integer or a float, depending on the value. */) | |||
| 1272 | return make_fixnum_or_float (uid); | 1272 | return make_fixnum_or_float (uid); |
| 1273 | } | 1273 | } |
| 1274 | 1274 | ||
| 1275 | DEFUN ("group-gid", Fgroup_gid, Sgroup_gid, 0, 0, 0, | ||
| 1276 | doc: /* Return the effective gid of Emacs. | ||
| 1277 | Value is an integer or a float, depending on the value. */) | ||
| 1278 | (void) | ||
| 1279 | { | ||
| 1280 | gid_t egid = getegid (); | ||
| 1281 | return make_fixnum_or_float (egid); | ||
| 1282 | } | ||
| 1283 | |||
| 1284 | DEFUN ("group-real-gid", Fgroup_real_gid, Sgroup_real_gid, 0, 0, 0, | ||
| 1285 | doc: /* Return the real gid of Emacs. | ||
| 1286 | Value is an integer or a float, depending on the value. */) | ||
| 1287 | (void) | ||
| 1288 | { | ||
| 1289 | gid_t gid = getgid (); | ||
| 1290 | return make_fixnum_or_float (gid); | ||
| 1291 | } | ||
| 1292 | |||
| 1275 | DEFUN ("user-full-name", Fuser_full_name, Suser_full_name, 0, 1, 0, | 1293 | DEFUN ("user-full-name", Fuser_full_name, Suser_full_name, 0, 1, 0, |
| 1276 | doc: /* Return the full name of the user logged in, as a string. | 1294 | doc: /* Return the full name of the user logged in, as a string. |
| 1277 | If the full name corresponding to Emacs's userid is not known, | 1295 | If the full name corresponding to Emacs's userid is not known, |
| @@ -4899,6 +4917,8 @@ functions if all the text being accessed has this property. */); | |||
| 4899 | defsubr (&Suser_real_login_name); | 4917 | defsubr (&Suser_real_login_name); |
| 4900 | defsubr (&Suser_uid); | 4918 | defsubr (&Suser_uid); |
| 4901 | defsubr (&Suser_real_uid); | 4919 | defsubr (&Suser_real_uid); |
| 4920 | defsubr (&Sgroup_gid); | ||
| 4921 | defsubr (&Sgroup_real_gid); | ||
| 4902 | defsubr (&Suser_full_name); | 4922 | defsubr (&Suser_full_name); |
| 4903 | defsubr (&Semacs_pid); | 4923 | defsubr (&Semacs_pid); |
| 4904 | defsubr (&Scurrent_time); | 4924 | defsubr (&Scurrent_time); |