From f5996ff4a1f387c078ecf499ac4279b2300f878c Mon Sep 17 00:00:00 2001 From: YRabbit Date: Sat, 16 Sep 2023 15:01:24 +1000 Subject: [PATCH] gowin: Himbaechel. Support DragonFlyBSD Signed-off-by: YRabbit --- common/kernel/command.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/common/kernel/command.cc b/common/kernel/command.cc index c7733674c3..ac154cc6eb 100644 --- a/common/kernel/command.cc +++ b/common/kernel/command.cc @@ -156,8 +156,7 @@ std::string proc_self_dirname(void) { char buf[PATH_MAX + 1] = "", *path, *p; // if case argv[0] contains a valid path, return it - if (strlen(npnr_path) > 0) { - p = strrchr(npnr_path, '/'); + if (strlen(npnr_path) > 0 && (p = strrchr(npnr_path, '/')) != NULL) { snprintf(buf, sizeof buf, "%*s/", (int)(npnr_path - p), npnr_path); return buf; }