From 1cc2afab4c909e07cef2d57720b84e7534c13ad9 Mon Sep 17 00:00:00 2001 From: Mask66 Date: Fri, 10 Feb 2017 18:36:29 +0100 Subject: [PATCH] use basename to select executable identity We ran into problems calling dma (on FreeBSD) from the nagios check_mailq script, and found out that it behaves correctly when called as just "mailq", but incorrectly when called as "/usr/bin/mailq" (with a path) for example. This patch written by my colleague Klaus-Uwe Ittner corrects this. Also reported as https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216910. --- dma.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dma.c b/dma.c index b87b202..e643e0f 100644 --- a/dma.c +++ b/dma.c @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #include @@ -457,7 +458,7 @@ main(int argc, char **argv) bzero(&queue, sizeof(queue)); LIST_INIT(&queue.queue); - if (strcmp(argv[0], "mailq") == 0) { + if (strcmp(basename(argv[0]), "mailq") == 0) { argv++; argc--; showq = 1; if (argc != 0) -- 2.47.3