Ignore $SYSTEMD_INVOKED_AS if empty
Let's treat unset SYSTEMD_INVOKED_AS and SYSTEMD_INVOKED_AS='' the same. I encountered this when testing various --help outputs. It is often more convenient to override a variable with VAR= instead of removing it, in particular on the commandline. But we'd then print help with the program name missing. We look at the variable in two places, so adjust both as in $subject.
This commit is contained in:
@@ -28,7 +28,7 @@ void save_argc_argv(int argc, char **argv) {
|
||||
}
|
||||
|
||||
bool invoked_as(char *argv[], const char *token) {
|
||||
const char *progname = secure_getenv("SYSTEMD_INVOKED_AS");
|
||||
const char *progname = empty_to_null(secure_getenv("SYSTEMD_INVOKED_AS"));
|
||||
|
||||
if (!progname && argv)
|
||||
progname = argv[0];
|
||||
|
||||
Reference in New Issue
Block a user