Skip to content

Commit

Permalink
statd: support for enabling DEBUG() logs with env, like confd
Browse files Browse the repository at this point in the history
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
  • Loading branch information
troglobit authored and wkz committed May 13, 2024
1 parent 16c21f0 commit 9d78173
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions package/statd/statd.conf
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
#set DEBUG=1

service name:statd log [S12345] <pid/confd> statd -f -p /run/statd.pid -n -- Status daemon
4 changes: 3 additions & 1 deletion src/statd/statd.c
Original file line number Diff line number Diff line change
Expand Up @@ -526,9 +526,11 @@ int main(int argc, char *argv[])
struct statd statd = {};
int log_opts = LOG_USER;
sr_conn_ctx_t *sr_conn;
char *env;
int err;

if (argc > 1 && !strcmp(argv[1], "-d")) {
env = getenv("DEBUG");
if (env || (argc > 1 && !strcmp(argv[1], "-d"))) {
log_opts |= LOG_PERROR;
debug = 1;
}
Expand Down

0 comments on commit 9d78173

Please sign in to comment.