1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-16 00:00:07 +01:00

lws_struct: sqlite3: avoid chown for windows

This commit is contained in:
Andy Green 2020-04-11 16:54:58 +01:00
parent 71a7064c19
commit d13f0444f3

View file

@ -442,7 +442,9 @@ int
lws_struct_sq3_open(struct lws_context *context, const char *sqlite3_path,
sqlite3 **pdb)
{
#if !defined(WIN32)
int uid = 0, gid = 0;
#endif
if (sqlite3_open_v2(sqlite3_path, pdb,
SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE,
@ -453,6 +455,7 @@ lws_struct_sq3_open(struct lws_context *context, const char *sqlite3_path,
return 1;
}
#if !defined(WIN32)
lws_get_effective_uid_gid(context, &uid, &gid);
if (uid)
chown(sqlite3_path, uid, gid);
@ -460,7 +463,9 @@ lws_struct_sq3_open(struct lws_context *context, const char *sqlite3_path,
lwsl_notice("%s: created %s owned by %u:%u mode 0600\n", __func__,
sqlite3_path, (unsigned int)uid, (unsigned int)gid);
#else
lwsl_notice("%s: created %s\n", __func__, sqlite3_path);
#endif
sqlite3_extended_result_codes(*pdb, 1);
return 0;