]>
Commit | Line | Data |
---|---|---|
831c28fd ER |
1 | |
2 | Fix dc_client: don't go setuid until after the pidfile has been written. | |
3 | ||
4 | --- distcache-1.4.5/sessclient/sclient.c.setuid | |
5 | +++ distcache-1.4.5/sessclient/sclient.c | |
6 | @@ -267,13 +267,6 @@ | |
7 | if(sockperms && !NAL_LISTENER_set_fs_perms(listener, sockperms)) | |
8 | SYS_fprintf(SYS_stderr, "Warning, can't set socket permissions " | |
9 | "to '%s', continuing anyway\n", sockperms); | |
10 | - if(user) { | |
11 | - if(!SYS_setuid(user)) { | |
12 | - SYS_fprintf(SYS_stderr, "Error, couldn't become user " | |
13 | - "'%s'.\n", user); | |
14 | - return 1; | |
15 | - } | |
16 | - } | |
17 | #endif | |
18 | ||
19 | /* Define a "now" value that can be used during initialisation and | |
20 | @@ -312,6 +305,13 @@ | |
21 | SYS_fprintf(fp, "%lu", (unsigned long)SYS_getpid()); | |
22 | fclose(fp); | |
23 | } | |
24 | + if(user) { | |
25 | + if(!SYS_setuid(user)) { | |
26 | + SYS_fprintf(SYS_stderr, "Error, couldn't become user " | |
27 | + "'%s'.\n", user); | |
28 | + return 1; | |
29 | + } | |
30 | + } | |
31 | #endif | |
32 | ||
33 | /* Choose an appropriate select timeout relative to the retry period */ |