This changes get_dss_pid() to handle the case where the caller passed
a NULL pid pointer. Conversely, if pid is not NULL, we now make sure
to initialize the given address in all cases.
The single caller currently never passes NULL, so this change is just
defensive programming, protecting against future users. Be liberal
in what you accept, be strict in what you return..
{
int ret, semid, key = get_key_or_die(config_file);
+ if (pid)
+ *pid = 0;
ret = mutex_get(key, 0);
if (ret < 0)
return ret;
ret = semctl(semid, 1, GETPID);
if (ret < 0)
return -E_NOT_RUNNING;
- *pid = ret;
+ if (pid)
+ *pid = ret;
ret = mutex_try_lock(semid);
if (ret >= 0)
return -E_NOT_RUNNING;