Bug in posix_spawn.c with patch

Maxim Solodovnik <[email protected]> Fri, 15 May 2026 13:56:05 +0700
Newsgroups gmane.comp.lib.newlib
Message-ID <CAJmbs8j5v6g4-bTReUKr--C_W3uLr=uO1hGtCfYTquhh_xx9gg@mail.gmail.com>
Hello,

I believe there is a bug in `newlib/libc/posix/posix_spawn.c`
closing curly bracket for `switch` at line 228
is inside `#ifdef HAVE_FCHDIR` block
thus the file is NOT compilable if `HAVE_FCHDIR` is NOT defined
the patch against `main` branch is attached :)

-- 
Best regards,
Maxim
posix_spawn.patch (text/x-patch, 378 B)
diff --git a/newlib/libc/posix/posix_spawn.c b/newlib/libc/posix/posix_spawn.c
index f63b3af8f..a4681fb10 100644
--- a/newlib/libc/posix/posix_spawn.c
+++ b/newlib/libc/posix/posix_spawn.c
@@ -225,8 +225,8 @@ process_file_actions_entry(posix_spawn_file_actions_entry_t *fae)
 		if (fchdir (fae->fae_dirfd) == -1)
 			return (errno);
 		break;
-	}
 #endif
+	}
 	return (0);
 }