aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/zed
diff options
context:
space:
mode:
authorнаб <[email protected]>2021-05-22 17:19:14 +0200
committerBrian Behlendorf <[email protected]>2021-06-11 09:10:21 -0700
commitfeb04e66802ef96aa77951c43d4b632b376041ef (patch)
tree0d78f6283f001f8f66828bef33c9ace4185f7802 /cmd/zed
parent64dfdaba372f07f91a6eab598b3480693b1d14c8 (diff)
Forbid basename(3) and dirname(3)
There are at least two interpretations of basename(3), in addition to both functions being allowed to /both/ return a static buffer (unsuitable in multi-threaded environments) /and/ raze the input (which encourages overallocations, at best) Reviewed-by: John Kennedy <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Ryan Moeller <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #12105
Diffstat (limited to 'cmd/zed')
-rw-r--r--cmd/zed/agents/zfs_retire.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/cmd/zed/agents/zfs_retire.c b/cmd/zed/agents/zfs_retire.c
index 1c4cc885b..1563f5d27 100644
--- a/cmd/zed/agents/zfs_retire.c
+++ b/cmd/zed/agents/zfs_retire.c
@@ -38,6 +38,7 @@
#include <sys/fs/zfs.h>
#include <sys/fm/protocol.h>
#include <sys/fm/fs/zfs.h>
+#include <libzutil.h>
#include <libzfs.h>
#include <string.h>
@@ -240,7 +241,7 @@ replace_with_spare(fmd_hdl_t *hdl, zpool_handle_t *zhp, nvlist_t *vdev)
ZPOOL_CONFIG_CHILDREN, &spares[s], 1);
fmd_hdl_debug(hdl, "zpool_vdev_replace '%s' with spare '%s'",
- dev_name, basename(spare_name));
+ dev_name, zfs_basename(spare_name));
if (zpool_vdev_attach(zhp, dev_name, spare_name,
replacement, B_TRUE, rebuild) == 0) {