about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-11-02 04:33:00 -0400
committerJune McEnroe <june@causal.agency>2019-11-02 04:33:00 -0400
commited154774513e7f25826a8d06a2c88cfb0443c01b (patch)
treefcba66736b872ae2bc11a9aaacf74fe691a069ca
parentImplement UNIX-domain binding (diff)
downloadpounce-ed154774513e7f25826a8d06a2c88cfb0443c01b.tar.gz
pounce-ed154774513e7f25826a8d06a2c88cfb0443c01b.zip
Fix trying to cap_rights_limit a NULL saveFile
Diffstat (limited to '')
-rw-r--r--bounce.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/bounce.c b/bounce.c
index a3a9693..01612e8 100644
--- a/bounce.c
+++ b/bounce.c
@@ -290,8 +290,10 @@ int main(int argc, char *argv[]) {
 	cap_rights_init(&bindRights, CAP_LISTEN, CAP_ACCEPT);
 	cap_rights_merge(&bindRights, &sockRights);
 
-	error = cap_rights_limit(fileno(saveFile), &saveRights);
-	if (error) err(EX_OSERR, "cap_rights_limit");
+	if (saveFile) {
+		error = cap_rights_limit(fileno(saveFile), &saveRights);
+		if (error) err(EX_OSERR, "cap_rights_limit");
+	}
 	splitLimit(certSplit, &fileRights);
 	splitLimit(privSplit, &fileRights);
 	for (size_t i = 0; i < binds; ++i) {