about summary refs log tree commit diff
path: root/posix/spawn_faction_addopen.c
diff options
context:
space:
mode:
Diffstat (limited to 'posix/spawn_faction_addopen.c')
-rw-r--r--posix/spawn_faction_addopen.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/posix/spawn_faction_addopen.c b/posix/spawn_faction_addopen.c
index 1405e91013..b177f07294 100644
--- a/posix/spawn_faction_addopen.c
+++ b/posix/spawn_faction_addopen.c
@@ -43,12 +43,15 @@ posix_spawn_file_actions_addopen (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_open;
   rec->action.open_action.fd = fd;
   rec->action.open_action.path = path;
   rec->action.open_action.oflag = oflag;
   rec->action.open_action.mode = mode;
 
+  /* Account for the new entry.  */
+  ++file_actions->__used;
+
   return 0;
 }