Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
92c203d7
Commit
92c203d7
authored
Feb 15, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
daemon: return early from daemonize_set_user()
If no "user" is configured, return from daemonize_set_user(). Save one level of indent.
parent
98994c59
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
19 deletions
+20
-19
daemon.c
src/daemon.c
+20
-19
No files found.
src/daemon.c
View file @
92c203d7
...
...
@@ -100,28 +100,29 @@ void
daemonize_set_user
(
void
)
{
#ifndef WIN32
if
(
user_name
!=
NULL
)
{
/* get uid */
if
(
setgid
(
user_gid
)
==
-
1
)
{
g_error
(
"cannot setgid for user
\"
%s
\"
: %s"
,
user_name
,
g_strerror
(
errno
));
}
if
(
user_name
==
NULL
)
return
;
/* get uid */
if
(
setgid
(
user_gid
)
==
-
1
)
{
g_error
(
"cannot setgid for user
\"
%s
\"
: %s"
,
user_name
,
g_strerror
(
errno
));
}
#ifdef _BSD_SOURCE
/* init suplementary groups
* (must be done before we change our uid)
*/
if
(
initgroups
(
user_name
,
user_gid
)
==
-
1
)
{
g_warning
(
"cannot init supplementary groups "
"of user
\"
%s
\"
: %s"
,
user_name
,
g_strerror
(
errno
));
}
/* init suplementary groups
* (must be done before we change our uid)
*/
if
(
initgroups
(
user_name
,
user_gid
)
==
-
1
)
{
g_warning
(
"cannot init supplementary groups "
"of user
\"
%s
\"
: %s"
,
user_name
,
g_strerror
(
errno
));
}
#endif
/* set uid */
if
(
setuid
(
user_uid
)
==
-
1
)
{
g_error
(
"cannot change to uid of user
\"
%s
\"
: %s"
,
user_name
,
g_strerror
(
errno
));
}
/* set uid */
if
(
setuid
(
user_uid
)
==
-
1
)
{
g_error
(
"cannot change to uid of user
\"
%s
\"
: %s"
,
user_name
,
g_strerror
(
errno
));
}
#endif
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment