Skip to content

Commit b32d98f

Browse files
committed
cdba-server: provide fallbacks for the username value
We use the CDBA_USER value as a way to pass info from cdba-shell to cdba-server. However if it is not provide (e.g. because the cdba-server is started directly by shell) add a fallback to the system's USER variable. And if that's also not set, provide a safe default of 'nobody'. Signed-off-by: Dmitry Baryshkov <[email protected]>
1 parent 3269b8b commit b32d98f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

cdba-server.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,10 @@ int main(int argc, char **argv)
356356
signal(SIGPIPE, sigpipe_handler);
357357

358358
username = getenv("CDBA_USER");
359+
if (!username)
360+
username = getenv("USER");
361+
if (!username)
362+
username = "nobody";
359363

360364
ret = device_parser(".cdba");
361365
if (ret) {

0 commit comments

Comments
 (0)