ucode: add missing return code checks for fchdir/chdir
authorFelix Fietkau <[email protected]>
Sun, 3 Aug 2025 04:16:42 +0000 (06:16 +0200)
committerFelix Fietkau <[email protected]>
Sun, 3 Aug 2025 04:16:44 +0000 (06:16 +0200)
Fixes build issue on glibc

Signed-off-by: Felix Fietkau <[email protected]>
ucode.c

diff --git a/ucode.c b/ucode.c
index a1b67f50a97a7513c686bbb25d6d8e4460619c46..fdddab7ed8123f27b0643ba47458d653beab1774 100644 (file)
--- a/ucode.c
+++ b/ucode.c
@@ -333,10 +333,12 @@ uc_netifd_start_process(uc_value_t *dir, uc_value_t *arg, uc_value_t *env, int *
                        break;
                fallthrough;
        case UC_INTEGER:
-               fchdir(ucv_int64_get(dir));
+               if (fchdir(ucv_int64_get(dir)) < 0)
+                       exit(1);
                break;
        case UC_STRING:
-               chdir(ucv_string_get(dir));
+               if (chdir(ucv_string_get(dir)) < 0)
+                       exit(1);
                break;
        default:
                break;