aboutsummaryrefslogtreecommitdiff
path: root/gmid.c
diff options
context:
space:
mode:
authorOmar Polo <op@omarpolo.com>2021-02-01 11:07:57 +0000
committerOmar Polo <op@omarpolo.com>2021-02-01 11:07:57 +0000
commitbcf5d929e608a3c61a79f5c021478760db54d271 (patch)
treecaa0512af97041a4eb19f66f998ee834806598fb /gmid.c
parent6ff23c673989f92a42da0029728fe80ca3dde40f (diff)
ensure absolute paths in config-less mode
Diffstat (limited to 'gmid.c')
-rw-r--r--gmid.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/gmid.c b/gmid.c
index d3ff036..4fbcbbb 100644
--- a/gmid.c
+++ b/gmid.c
@@ -19,6 +19,7 @@
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
+#include <limits.h>
#include <netdb.h>
#include <pwd.h>
#include <signal.h>
@@ -544,11 +545,14 @@ main(int argc, char **argv)
hosts[0].locations[0].match = "*";
switch (argc) {
- case 0:
- hosts[0].dir = ".";
+ case 0: {
+ char path[PATH_MAX];
+
+ hosts[0].dir = getcwd(path, sizeof(path));
break;
+ }
case 1:
- hosts[0].dir = argv[0];
+ hosts[0].dir = absolutify_path(argv[0]);
break;
default:
usage(getprogname());