From 6bc987b4b95f41a9e40db399ccfc494fabec8f02 Mon Sep 17 00:00:00 2001 From: Tai Groot Date: Wed, 23 Jul 2025 23:00:01 -0700 Subject: [PATCH] update crontab ownership --- toys/pending/crontab.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/toys/pending/crontab.c b/toys/pending/crontab.c index ced5755e..5d3ba640 100644 --- a/toys/pending/crontab.c +++ b/toys/pending/crontab.c @@ -232,6 +232,7 @@ static void do_remove(char *name) static void update_crontab(char *src, char *dest) { int fdin, fdout; + struct passwd *pwd = xgetpwnam(dest); snprintf(toybuf, sizeof(toybuf), "%s%s", TT.cdir, dest); unlink(toybuf); @@ -240,7 +241,7 @@ static void update_crontab(char *src, char *dest) xsendfile(fdin, fdout); xclose(fdin); - fchown(fdout, getuid(), geteuid()); + fchown(fdout, pwd->pw_uid, pwd->pw_gid); xclose(fdout); } -- 2.39.5