logit: fall back to package name if $LOGNAME and $USER are unset

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2022-10-16 20:01:29 +02:00
parent c5bca5f80a
commit 19f5cb1d01
+7 -2
View File
@@ -208,8 +208,13 @@ int main(int argc, char *argv[])
}
}
if (!ident)
ident = getenv("LOGNAME") ?: getenv("USER");
if (!ident) {
ident = getenv("LOGNAME");
if (!ident)
ident = getenv("USER");
if (!ident)
ident = PACKAGE_NAME;
}
if (optind < argc) {
size_t pos = 0, len = sizeof(buf);