aboutsummaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
authorEd Maste <emaste@FreeBSD.org>2024-11-27 20:36:46 +0000
committerEd Maste <emaste@FreeBSD.org>2024-11-28 13:04:10 +0000
commit062b69ba045dc0fef3d9b8d73365d2798c05a480 (patch)
tree2fed7eff55fd4b01c5a3567405758d8eed162ddf /libexec
parent2e2699c48a7e6b7cbf13611a601a6cd264a80ec5 (diff)
Diffstat (limited to 'libexec')
-rw-r--r--libexec/comsat/comsat.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libexec/comsat/comsat.c b/libexec/comsat/comsat.c
index 2d2141238a4e..76f6190bea7b 100644
--- a/libexec/comsat/comsat.c
+++ b/libexec/comsat/comsat.c
@@ -213,8 +213,10 @@ jkfprintf(FILE *tp, char user[], char file[], off_t offset)
unsigned char line[BUFSIZ];
/* Set effective uid to user in case mail drop is on nfs */
- if ((p = getpwnam(user)) != NULL)
- (void) setuid(p->pw_uid);
+ if ((p = getpwnam(user)) == NULL)
+ return;
+ if (setuid(p->pw_uid) != 0)
+ return;
if ((fi = fopen(file, "r")) == NULL)
return;