*word = w_addmem (*word, word_length, max_length, buffer, buflen); if (*word == NULL) goto no_space;
exec_comm (char *comm, char **word, size_t *word_length, size_t *max_length,	   int flags, wordexp_t *pwordexp, const char *ifs,	   const char *ifs_white){  int fildes[2];  int bufsize = 128;  int buflen;  char *buffer;  pid_t pid;  /* Don't fork() unless necessary */  if (!comm || !*comm)    return 0;  if (__pipe (fildes))    /* Bad */    return WRDE_NOSPACE;  if ((pid = __fork ()) < 0)    {      /* Bad */      __close (fildes[0]);      __close (fildes[1]);      return WRDE_NOSPACE;    }  if (pid == 0)    {      /* Child */      const char *args[4] = { _PATH_BSHELL, "-c", comm, NULL };      /* Redirect output.  */      __dup2 (fildes[1], 1);      __close (fildes[1]);      /* Redirect stderr to /dev/null if we have to.  */      if ((flags & WRDE_SHOWERR) == 0)	{	  int fd;	  __close (2);	  fd = __open (_PATH_DEVNULL, O_WRONLY);	  if (fd >= 0 && fd != 2)	    {	      __dup2 (fd, 2);	      __close (fd);	    }	}      __close (fildes[0]);      __execve (_PATH_BSHELL, (char *const *) args, __environ);      /* Bad.  What now?  */      abort ();    }  /* Parent */  __close (fildes[1]);  buffer = __alloca (bufsize);  /* Read fildes[0] and put it into a word. */  while (1)    {      if ((buflen = __read (fildes[0], buffer, bufsize)) < 1)	{	  if (__waitpid (pid, NULL, WNOHANG) == 0)	    continue;	  if ((buflen = __read (fildes[0], buffer, bufsize)) < 1)	    break;	}      *word = w_addmem (*word, word_length, max_length, buffer, buflen);      if (*word == NULL)	goto no_space;    }  /* Bash chops off trailing newlines, which seems sensible.  */  while (*word_length > 0 && (*word)[*word_length - 1] == '\n')    {      (*word)[--*word_length] = '\0';      /* If the last word was entirely newlines, turn it into a new word       * which can be ignored if there's nothing following it. */      if (*word_length == 0)	{	  free (*word);	  *word = w_newword (word_length, max_length);	  break;	}    }  __close (fildes[0]);  return 0;no_space:  __kill (pid, SIGKILL);  __waitpid (pid, NULL, 0);  __close (fildes[0]);  return WRDE_NOSPACE;}