summaryrefslogtreecommitdiff
path: root/net-libs/libwebsockets/files/libwebsockets-3.2.0-check_chown_result.patch
blob: 3dafd60e7315213b770b923859ffd520719fb06f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
--- libwebsockets-3.2.0.o/lib/misc/lws-struct-sqlite.c	2019-08-14 10:22:50.000000000 +0200
+++ libwebsockets-3.2.0/lib/misc/lws-struct-sqlite.c	2019-11-07 20:03:43.939423877 +0200
@@ -23,6 +23,7 @@
 #include <core/private.h>
 
 #include <sqlite3.h>
+#include <string.h>
 
 /*
  * we get one of these per matching result from the query
@@ -253,8 +254,9 @@
 	}
 
 	lws_get_effective_uid_gid(context, &uid, &gid);
-	if (uid)
-		chown(sqlite3_path, uid, gid);
+	if (uid && chown(sqlite3_path, uid, gid) < 0)
+		lwsl_err("%s: Error setting ownership of %s: %s\n",
+				__func__, sqlite3_path, strerror(errno));
 	chmod(sqlite3_path, 0600);
 
 	lwsl_notice("%s: created %s owned by %u:%u mode 0600\n", __func__,