Rev 61 | Rev 65 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 61 | Rev 63 | ||
---|---|---|---|
Line 3... | Line 3... | ||
3 | /**
|
3 | /**
|
4 | * \file usertable.cpp
|
4 | * \file usertable.cpp
|
5 | *
|
5 | *
|
6 | * inotify cron system
|
6 | * inotify cron system
|
7 | *
|
7 | *
|
8 | * Copyright (C) 2006 Lukas Jelinek, <lukas@aiken.cz>
|
8 | * Copyright (C) 2006, 2007 Lukas Jelinek, <lukas@aiken.cz>
|
9 | *
|
9 | *
|
10 | * This program is free software; you can use it, redistribute
|
10 | * This program is free software; you can use it, redistribute
|
11 | * it and/or modify it under the terms of the GNU General Public
|
11 | * it and/or modify it under the terms of the GNU General Public
|
12 | * License, version 2 (see LICENSE-GPL).
|
12 | * License, version 2 (see LICENSE-GPL).
|
13 | *
|
13 | *
|
Line 208... | Line 208... | ||
208 | pd.pid = fork(); |
208 | pd.pid = fork(); |
209 | if (pd.pid == 0) { |
209 | if (pd.pid == 0) { |
210 | 210 | ||
211 | struct passwd* pwd = getpwnam(m_user.c_str()); |
211 | struct passwd* pwd = getpwnam(m_user.c_str()); |
212 | if ( pwd == NULL // user not found |
212 | if ( pwd == NULL // user not found |
213 | || setuid(pwd->pw_uid) != 0 // setting UID failed |
- | |
214 | || setgid(pwd->pw_gid) != 0 // setting GID failed |
213 | || setgid(pwd->pw_gid) != 0 // setting GID failed |
- | 214 | || setuid(pwd->pw_uid) != 0 // setting UID failed |
|
215 | || execvp(argv[0], argv) != 0) // exec failed |
215 | || execvp(argv[0], argv) != 0) // exec failed |
216 | {
|
216 | {
|
- | 217 | syslog(LOG_ERR, "cannot exec process: %s", strerror(errno)); |
|
217 | _exit(1); |
218 | _exit(1); |
218 | }
|
219 | }
|
219 | }
|
220 | }
|
220 | else if (pd.pid > 0) { |
221 | else if (pd.pid > 0) { |
221 | if (pE->IsNoLoop()) { |
222 | if (pE->IsNoLoop()) { |