summary refs log tree commit diff
path: root/pkgs/os-specific/linux/util-linux/rtcwake-search-PATH-for-shutdown.patch
blob: 3615984ed0cb5aab36114fbf541f13ed54d972c5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Search $PATH for the shutdown binary instead of hard-coding /sbin/shutdown,
which isn't valid on NixOS (and a compatibility link on most other modern
distros anyway).

  -- nckx <tobias.geerinckx.rice@gmail.com>
diff --git a/include/pathnames.h b/include/pathnames.h
index de6a13c..0c1aeb9 100644
--- a/include/pathnames.h
+++ b/include/pathnames.h
@@ -50,7 +50,7 @@
 #define	_PATH_VAR_NOLOGIN	"/var/run/nologin"
 
 #define _PATH_LOGIN		"/bin/login"
-#define _PATH_SHUTDOWN		"/sbin/shutdown"
+#define _PATH_SHUTDOWN		"shutdown"
 
 #define _PATH_TERMCOLORS_DIRNAME "terminal-colors.d"
 #define _PATH_TERMCOLORS_DIR	"/etc/" _PATH_TERMCOLORS_DIRNAME
diff --git a/sys-utils/rtcwake.c b/sys-utils/rtcwake.c
index 7c748dc..9a99a7c 100644
--- a/sys-utils/rtcwake.c
+++ b/sys-utils/rtcwake.c
@@ -575,7 +575,7 @@ int main(int argc, char **argv)
 		arg[i++] = "now";
 		arg[i]   = NULL;
 		if (!ctl.dryrun) {
-			execv(arg[0], arg);
+			execvp(arg[0], arg);
 			warn(_("failed to execute %s"), _PATH_SHUTDOWN);
 			rc = EXIT_FAILURE;
 		}