diff options
Diffstat (limited to 'posix')
-rw-r--r-- | posix/spawn_faction_addclose.c | 4 | ||||
-rw-r--r-- | posix/spawn_faction_adddup2.c | 4 | ||||
-rw-r--r-- | posix/spawn_faction_addopen.c | 4 | ||||
-rw-r--r-- | posix/spawn_faction_init.c | 13 |
4 files changed, 13 insertions, 12 deletions
diff --git a/posix/spawn_faction_addclose.c b/posix/spawn_faction_addclose.c index b093f2812a..af3b43045d 100644 --- a/posix/spawn_faction_addclose.c +++ b/posix/spawn_faction_addclose.c @@ -35,10 +35,10 @@ posix_spawn_file_actions_addclose (posix_spawn_file_actions_t *file_actions, if (fd < 0 || fd >= maxfd) return EBADF; - /* Allocate more memory of needed. */ + /* Allocate more memory if needed. */ if (file_actions->__used == file_actions->__allocated && __posix_spawn_file_actions_realloc (file_actions) != 0) - /* THis can only mean we ran out of memory. */ + /* This can only mean we ran out of memory. */ return ENOMEM; /* Add the new value. */ diff --git a/posix/spawn_faction_adddup2.c b/posix/spawn_faction_adddup2.c index f8de8ca7f6..46dd5ed129 100644 --- a/posix/spawn_faction_adddup2.c +++ b/posix/spawn_faction_adddup2.c @@ -35,10 +35,10 @@ posix_spawn_file_actions_adddup2 (posix_spawn_file_actions_t *file_actions, if (fd < 0 || newfd < 0 || fd >= maxfd || newfd >= maxfd) return EBADF; - /* Allocate more memory of needed. */ + /* Allocate more memory if needed. */ if (file_actions->__used == file_actions->__allocated && __posix_spawn_file_actions_realloc (file_actions) != 0) - /* THis can only mean we ran out of memory. */ + /* This can only mean we ran out of memory. */ return ENOMEM; /* Add the new value. */ diff --git a/posix/spawn_faction_addopen.c b/posix/spawn_faction_addopen.c index 3e0c62659e..f438ec1c1e 100644 --- a/posix/spawn_faction_addopen.c +++ b/posix/spawn_faction_addopen.c @@ -36,10 +36,10 @@ posix_spawn_file_actions_addopen (posix_spawn_file_actions_t *file_actions, if (fd < 0 || fd >= maxfd) return EBADF; - /* Allocate more memory of needed. */ + /* Allocate more memory if needed. */ if (file_actions->__used == file_actions->__allocated && __posix_spawn_file_actions_realloc (file_actions) != 0) - /* THis can only mean we ran out of memory. */ + /* This can only mean we ran out of memory. */ return ENOMEM; /* Add the new value. */ diff --git a/posix/spawn_faction_init.c b/posix/spawn_faction_init.c index edd41ddd6f..f4b0775b0b 100644 --- a/posix/spawn_faction_init.c +++ b/posix/spawn_faction_init.c @@ -21,23 +21,24 @@ #include <stdlib.h> #include <string.h> +#include "spawn_int.h" + /* Function used to increase the size of the allocated array. This function is called from the `add'-functions. */ int __posix_spawn_file_actions_realloc (posix_spawn_file_actions_t *file_actions) { + int newalloc = file_actions->__allocated + 8; void *newmem = realloc (file_actions->__actions, - file_actions->__allocated += 8); + newalloc * sizeof (struct __spawn_action)); if (newmem == NULL) - { - /* Not enough memory. */ - file_actions->__allocated -= 8; - return ENOMEM; - } + /* Not enough memory. */ + return ENOMEM; file_actions->__actions = (struct __spawn_action *) newmem; + file_actions->__allocated = newalloc; return 0; } |