Skip to content

Commit

Permalink
change call from chown to fchown
Browse files Browse the repository at this point in the history
  • Loading branch information
ptc committed Mar 21, 2024
1 parent f82c21e commit 1f53001
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion crontab.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ main(int ac, char **av)
* Then we delete the temp file, keeping its fd as repFd
*/
if ((fd = mkstemp(tmp)) >= 0) {
chown(tmp, getuid(), getgid());
fchown(fd, getuid(), getgid());
if ((fi = fopen(pas->pw_name, "r"))) {
while ((n = fread(buf, 1, sizeof(buf), fi)) > 0)
write(fd, buf, n);
Expand Down

0 comments on commit 1f53001

Please sign in to comment.