Follow-up to issue #81, don't append error message again.

Also, when called multiple times, return workaround immediately instead
of warning again.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson
2017-10-01 22:07:21 +02:00
parent 3d4e3c99ed
commit 53de1c8575
+4 -1
View File
@@ -43,13 +43,16 @@ static svc_t *__connect_shm(void)
list = finit_svc_connect();
if (!list) {
if (workaround)
return workaround;
/* Linux not built with CONFIG_SYSVIPC, or libc does not support shmat()/shmget() */
if (ENOSYS == errno)
warn("Kernel does support SYSV shmat() IPC, error %d", errno);
/* Try to prevent PID 1 from aborting, issue #81 */
if (getpid() == 1) {
warn("Implementing PID 1 workaround, initctl tool will not work ...");
warnx("Implementing PID 1 workaround, initctl tool will not work ...");
if (!workaround)
workaround = calloc(MAX_NUM_SVC, sizeof(svc_t));