Misc. macro cleanup

- ROOT_UID's comment is misleading, as it's always defined to 0.

- SEEK_{SET,END} & O_NOFOLLOW should already be defined on Unix-like
  systems in <stdio.h> and <fcntl.h>, respectively.  In any case,
  neither of those #ifdef blocks should be in the middle of source files.

- The S_IS{LNK,DIR,...} macros should only be undefined on Windows.
This commit is contained in:
Michael Reed
2016-01-14 16:05:23 -05:00
parent 24fbb2c866
commit 07265d221f
7 changed files with 28 additions and 53 deletions

View File

@@ -3082,8 +3082,8 @@ shada_write_file_nomerge: {}
// viminfo file that the user can't read.
FileInfo old_info;
if (os_fileinfo((char *)fname, &old_info)) {
if (getuid() == ROOT_UID) {
if (old_info.stat.st_uid != ROOT_UID
if (getuid() == 0) {
if (old_info.stat.st_uid != 0
|| old_info.stat.st_gid != getgid()) {
const uv_uid_t old_uid = (uv_uid_t) old_info.stat.st_uid;
const uv_gid_t old_gid = (uv_gid_t) old_info.stat.st_gid;