summary refs log tree commit diff
path: root/posix/spawn_faction_addclose.c
diff options
context:
space:
mode:
Diffstat (limited to 'posix/spawn_faction_addclose.c')
-rw-r--r--posix/spawn_faction_addclose.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/posix/spawn_faction_addclose.c b/posix/spawn_faction_addclose.c
index 565f4b43f7..b90abb1f7a 100644
--- a/posix/spawn_faction_addclose.c
+++ b/posix/spawn_faction_addclose.c
@@ -42,9 +42,12 @@ posix_spawn_file_actions_addclose (posix_spawn_file_actions_t *file_actions,
     return ENOMEM;
 
   /* Add the new value.  */
-  rec = &file_actions->__actions[file_actions->__allocated];
+  rec = &file_actions->__actions[file_actions->__used];
   rec->tag = spawn_do_close;
   rec->action.open_action.fd = fd;
 
+  /* Account for the new entry.  */
+  ++file_actions->__used;
+
   return 0;
 }