equal
deleted
inserted
replaced
233 // put in listen mode, set permissions, and rename into place |
233 // put in listen mode, set permissions, and rename into place |
234 res = ::listen(listener, 5); |
234 res = ::listen(listener, 5); |
235 if (res == 0) { |
235 if (res == 0) { |
236 RESTARTABLE(::chmod(initial_path, S_IREAD|S_IWRITE), res); |
236 RESTARTABLE(::chmod(initial_path, S_IREAD|S_IWRITE), res); |
237 if (res == 0) { |
237 if (res == 0) { |
238 res = ::rename(initial_path, path); |
238 // make sure the file is owned by the effective user and effective group |
|
239 // e.g. the group could be inherited from the directory in case the s bit is set |
|
240 RESTARTABLE(::chown(initial_path, geteuid(), getegid()), res); |
|
241 if (res == 0) { |
|
242 res = ::rename(initial_path, path); |
|
243 } |
239 } |
244 } |
240 } |
245 } |
241 if (res == -1) { |
246 if (res == -1) { |
242 ::close(listener); |
247 ::close(listener); |
243 ::unlink(initial_path); |
248 ::unlink(initial_path); |