try to ensure proper ownership of db_dir
If user has been set, try to ensure that db_dir is owned by that user. If that fails, log an error.
This commit is contained in:
parent
4236d53b59
commit
6cef303fc1
@ -938,6 +938,14 @@ init(int argc, char **argv)
|
|||||||
if (writepidfile(pidfilename, pid, uid) != 0)
|
if (writepidfile(pidfilename, pid, uid) != 0)
|
||||||
pidfilename = NULL;
|
pidfilename = NULL;
|
||||||
|
|
||||||
|
if (uid >= 0)
|
||||||
|
{
|
||||||
|
struct stat st;
|
||||||
|
if (stat(db_path, &st) == 0 && st.st_uid != uid && chown(db_path, uid, -1) != 0)
|
||||||
|
DPRINTF(E_ERROR, L_GENERAL, "Unable to set db_path [%s] ownership to %d: %s\n",
|
||||||
|
db_path, uid, strerror(errno));
|
||||||
|
}
|
||||||
|
|
||||||
if (uid != -1 && setuid(uid) == -1)
|
if (uid != -1 && setuid(uid) == -1)
|
||||||
DPRINTF(E_FATAL, L_GENERAL, "Failed to switch to uid '%d'. [%s] EXITING.\n",
|
DPRINTF(E_FATAL, L_GENERAL, "Failed to switch to uid '%d'. [%s] EXITING.\n",
|
||||||
uid, strerror(errno));
|
uid, strerror(errno));
|
||||||
|
@ -733,7 +733,7 @@ SendSSDPGoodbyes(int s)
|
|||||||
(i > 0 ? "::" : ""),
|
(i > 0 ? "::" : ""),
|
||||||
(i > 0 ? known_service_types[i] : ""),
|
(i > 0 ? known_service_types[i] : ""),
|
||||||
(i > 1 ? "1" : ""));
|
(i > 1 ? "1" : ""));
|
||||||
DPRINTF(E_MAXDEBUG, L_SSDP, "Sending ssdp:byebye [%s]\n", s);
|
DPRINTF(E_MAXDEBUG, L_SSDP, "Sending ssdp:byebye [%d]\n", s);
|
||||||
n = sendto(s, bufr, l, 0,
|
n = sendto(s, bufr, l, 0,
|
||||||
(struct sockaddr *)&sockname, sizeof(struct sockaddr_in) );
|
(struct sockaddr *)&sockname, sizeof(struct sockaddr_in) );
|
||||||
if (n < 0)
|
if (n < 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user