mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-08-05 13:27:09 +02:00
49 lines
1.6 KiB
Diff
49 lines
1.6 KiB
Diff
Patch-Source: https://github.com/dankamongmen/growlight/commit/aa4b53cf6ecdd52dfa425a5a6165f9bc66efdd0f
|
|
--
|
|
From aa4b53cf6ecdd52dfa425a5a6165f9bc66efdd0f Mon Sep 17 00:00:00 2001
|
|
From: nick black <dankamongmen@gmail.com>
|
|
Date: Fri, 30 Aug 2024 03:23:31 -0400
|
|
Subject: [PATCH] drop all uses of basename(2)
|
|
|
|
the POSIX variant of basename(2) can freely write
|
|
to the string it is passed. in all call sites, we
|
|
were passing a const char* ultimately sourced
|
|
from argv[0], to which we must not write. the GNU
|
|
variant doesn't have this behavior, but we can't
|
|
assume that variant on e.g. musl.
|
|
|
|
so just drop the basename() calls entirely. they
|
|
didn't add much, and arguably lost information.
|
|
|
|
thanks to znley and celeste of alpine for bringing
|
|
this to my attention in
|
|
|
|
https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/71142
|
|
|
|
alpine linux: always kicking ass
|
|
---
|
|
src/growlight.c | 4 ++--
|
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/src/growlight.c b/src/growlight.c
|
|
index 283e6a2..9ebc901 100644
|
|
--- a/src/growlight.c
|
|
+++ b/src/growlight.c
|
|
@@ -1501,14 +1501,14 @@ watch_dir(int fd, const char *dfp, eventfxn fxn, int *wd, int timeout){
|
|
|
|
static void
|
|
version(const char *name){
|
|
- diag("%s version %s\n", basename(name), VERSION);
|
|
+ diag("%s version %s\n", name, VERSION);
|
|
}
|
|
|
|
static void
|
|
usage(const char *name, int disphelp){
|
|
diag("usage: %s [ -h|--help ] [ -v|--verbose ] [ -V|--version ]\n"
|
|
"\t[ -t|--target=path ] [ --notroot ] [ -i|--import ]%s\n",
|
|
- basename(name), disphelp ? " [ --disphelp ]" : "");
|
|
+ name, disphelp ? " [ --disphelp ]" : "");
|
|
}
|
|
|
|
static int
|