about summary refs log tree commit diff
path: root/posix/spawnattr_setflags.c
diff options
context:
space:
mode:
Diffstat (limited to 'posix/spawnattr_setflags.c')
-rw-r--r--posix/spawnattr_setflags.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/posix/spawnattr_setflags.c b/posix/spawnattr_setflags.c
index 3618efab45..0c3f5d20b7 100644
--- a/posix/spawnattr_setflags.c
+++ b/posix/spawnattr_setflags.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2004 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -16,13 +16,26 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#include <errno.h>
 #include <spawn.h>
 #include <string.h>
 
+#define ALL_FLAGS (POSIX_SPAWN_RESETIDS					      \
+		   | POSIX_SPAWN_SETPGROUP				      \
+		   | POSIX_SPAWN_SETSIGDEF				      \
+		   | POSIX_SPAWN_SETSIGMASK				      \
+		   | POSIX_SPAWN_SETSCHEDPARAM				      \
+		   | POSIX_SPAWN_SETSCHEDULER				      \
+		   | POSIX_SPAWN_USEVFORK)
+
 /* Store flags in the attribute structure.  */
 int
 posix_spawnattr_setflags (posix_spawnattr_t *attr, short int flags)
 {
+  /* Check no invalid bits are set.  */
+  if (flags & ~ALL_FLAGS)
+    return EINVAL;
+
   /* Store the flag word.  */
   attr->__flags = flags;