diff --git a/plugins/popen.c b/plugins/popen.c
index cde3c7647465ca26e7effd9cae8617a27bf86780..d4151e6142338c01933edb69548e987b2b79ed3d 100644 (file)
--- a/plugins/popen.c
+++ b/plugins/popen.c
pid_t pid;
if (childpid == NULL)
- return (-1); /* popen() has never been called */
+ return (1); /* popen() has never been called */
fd = fileno (fp);
if ((pid = childpid[fd]) == 0)
- return (-1); /* fp wasn't opened by popen() */
+ return (1); /* fp wasn't opened by popen() */
childpid[fd] = 0;
if (fclose (fp) == EOF)
- return (-1);
+ return (1);
while (waitpid (pid, &stat, 0) < 0)
if (errno != EINTR)
- return (-1); /* error other than EINTR from waitpid() */
+ return (1); /* error other than EINTR from waitpid() */
if (WIFEXITED (stat))
return (WEXITSTATUS (stat)); /* return child's termination status */
- return (STATE_UNKNOWN);
+ return (1);
}
#ifdef OPEN_MAX
rtrim (char *str, const char *tok)
{
int i = 0;
+ int j = sizeof (str);
- while (str != NULL) {
+ while (str != NULL && i < j) {
if (*(str + i) == *tok) {
sprintf (str + i, "%s", "\0");
return str;