Lines 68-74
static int do_check(char *path, uid_t uid, gid_t gid, mode_t mode,
Link Here
|
68 |
int u; |
68 |
int u; |
69 |
|
69 |
|
70 |
memset(&st, 0, sizeof(st)); |
70 |
memset(&st, 0, sizeof(st)); |
71 |
if (stat(path, &st) || trunc) { |
71 |
if (lstat(path, &st) || trunc) { |
72 |
if (type == inode_file) { |
72 |
if (type == inode_file) { |
73 |
einfo("%s: creating file", path); |
73 |
einfo("%s: creating file", path); |
74 |
if (!mode) /* 664 */ |
74 |
if (!mode) /* 664 */ |
Lines 133-142
static int do_check(char *path, uid_t uid, gid_t gid, mode_t mode,
Link Here
|
133 |
} |
133 |
} |
134 |
|
134 |
|
135 |
if (mode && (st.st_mode & 0777) != mode) { |
135 |
if (mode && (st.st_mode & 0777) != mode) { |
136 |
if ((type != inode_dir) && (st.st_nlink != 1)) { |
136 |
if ((type != inode_dir) && (st.st_nlink > 1)) { |
137 |
eerror("%s: chmod: %s %s", applet, "Too many hard links to", path); |
137 |
eerror("%s: chmod: %s %s", applet, "Too many hard links to", path); |
138 |
return -1; |
138 |
return -1; |
139 |
} |
139 |
} |
|
|
140 |
if (S_ISLNK(st.st_mode)) { |
141 |
eerror("%s: chmod: %s %s", applet, path, " is a symbolic link"); |
142 |
return -1; |
143 |
} |
140 |
einfo("%s: correcting mode", path); |
144 |
einfo("%s: correcting mode", path); |
141 |
if (chmod(path, mode)) { |
145 |
if (chmod(path, mode)) { |
142 |
eerror("%s: chmod: %s", applet, strerror(errno)); |
146 |
eerror("%s: chmod: %s", applet, strerror(errno)); |
Lines 145-154
static int do_check(char *path, uid_t uid, gid_t gid, mode_t mode,
Link Here
|
145 |
} |
149 |
} |
146 |
|
150 |
|
147 |
if (chowner && (st.st_uid != uid || st.st_gid != gid)) { |
151 |
if (chowner && (st.st_uid != uid || st.st_gid != gid)) { |
148 |
if ((type != inode_dir) && (st.st_nlink != 1)) { |
152 |
if ((type != inode_dir) && (st.st_nlink > 1)) { |
149 |
eerror("%s: chown: %s %s", applet, "Too many hard links to", path); |
153 |
eerror("%s: chown: %s %s", applet, "Too many hard links to", path); |
150 |
return -1; |
154 |
return -1; |
151 |
} |
155 |
} |
|
|
156 |
if (S_ISLNK(st.st_mode)) { |
157 |
eerror("%s: chown: %s %s", applet, path, " is a symbolic link"); |
158 |
return -1; |
159 |
} |
152 |
einfo("%s: correcting owner", path); |
160 |
einfo("%s: correcting owner", path); |
153 |
if (chown(path, uid, gid)) { |
161 |
if (chown(path, uid, gid)) { |
154 |
eerror("%s: chown: %s", applet, strerror(errno)); |
162 |
eerror("%s: chown: %s", applet, strerror(errno)); |
155 |
- |
|
|