Bug in posix_spawn.c with patch

Message ID CAJmbs8j5v6g4-bTReUKr--C_W3uLr=uO1hGtCfYTquhh_xx9gg@mail.gmail.com
State New
Headers
Series Bug in posix_spawn.c with patch |

Commit Message

Maxim Solodovnik May 15, 2026, 6:56 a.m. UTC
  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 :)
  

Comments

Jeff Johnston May 15, 2026, 6:29 p.m. UTC | #1
Patch applied.  Thanks.

-- Jeff J.

On Fri, May 15, 2026 at 2:56 AM Maxim Solodovnik <solomax666@gmail.com>
wrote:

> 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
>
  

Patch

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);
 }