Lines 68-98
Link Here
|
68 |
return result; |
68 |
return result; |
69 |
} |
69 |
} |
70 |
|
70 |
|
71 |
void start_server() |
|
|
72 |
{ |
73 |
pid_t cpid; |
74 |
int status; |
75 |
|
76 |
cpid = fork(); |
77 |
if(cpid == 0) |
78 |
{ |
79 |
// Detach ourself so PAM does not have a fit |
80 |
cpid = fork(); |
81 |
|
82 |
if(cpid != 0) |
83 |
{ |
84 |
exit(0); |
85 |
} |
86 |
setsid(); |
87 |
|
88 |
execl(SERVER_PATH SERVER_NAME, SERVER_NAME, 0); |
89 |
exit(0); |
90 |
} |
91 |
waitpid(cpid, &status, 0); |
92 |
|
93 |
return; |
94 |
} |
95 |
|
96 |
int open_unix_socket(char *name) |
71 |
int open_unix_socket(char *name) |
97 |
{ |
72 |
{ |
98 |
struct stat stat_buf; |
73 |
struct stat stat_buf; |
Lines 204-210
Link Here
|
204 |
cs = unix_connect(SOCKET_NAME); |
179 |
cs = unix_connect(SOCKET_NAME); |
205 |
if(cs < 0) |
180 |
if(cs < 0) |
206 |
{ |
181 |
{ |
207 |
start_server(); |
|
|
208 |
while(attempts > 0) |
182 |
while(attempts > 0) |
209 |
{ |
183 |
{ |
210 |
attempts--; |
184 |
attempts--; |
Lines 274-281
Link Here
|
274 |
|
248 |
|
275 |
if(cs < 0) |
249 |
if(cs < 0) |
276 |
{ |
250 |
{ |
277 |
// could not connect, try to start the server... |
|
|
278 |
start_server(); |
279 |
cs = unix_connect(SOCKET_NAME); |
251 |
cs = unix_connect(SOCKET_NAME); |
280 |
} |
252 |
} |
281 |
|
253 |
|