summaryrefslogtreecommitdiff
path: root/namedev.c
diff options
context:
space:
mode:
authorkay.sievers@vrfy.org <kay.sievers@vrfy.org>2003-12-15 22:38:18 -0800
committerGreg KH <gregkh@suse.de>2005-04-26 21:13:07 -0700
commit2052464275b50f27cc563aaee24aadd791a9d8ca (patch)
treee64bedaa91454dec1557047d45b5adb2dafbc73e /namedev.c
parent5a3ee97760a8882e22435ca6424c54af8d8782be (diff)
[PATCH] remove '\n' from end of callout return
remove possible newline at end of callout output, for easier matching with ID=
Diffstat (limited to 'namedev.c')
-rw-r--r--namedev.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/namedev.c b/namedev.c
index 633a7bf0da..74a411799b 100644
--- a/namedev.c
+++ b/namedev.c
@@ -264,7 +264,7 @@ static int exec_callout(struct config_device *dev, char *value, int len)
pid_t pid;
int value_set = 0;
char buffer[256];
- char *arg;
+ char *pos;
char *args[CALLOUT_MAXARG];
int i;
@@ -286,9 +286,9 @@ static int exec_callout(struct config_device *dev, char *value, int len)
dup(fds[1]); /* dup write side of pipe to STDOUT */
if (strchr(dev->exec_program, ' ')) {
/* callout with arguments */
- arg = dev->exec_program;
+ pos = dev->exec_program;
for (i=0; i < CALLOUT_MAXARG-1; i++) {
- args[i] = strsep(&arg, " ");
+ args[i] = strsep(&pos, " ");
if (args[i] == NULL)
break;
}
@@ -324,9 +324,12 @@ static int exec_callout(struct config_device *dev, char *value, int len)
} else {
value_set = 1;
strncpy(value, buffer, len);
+ pos = value + strlen(value)-1;
+ if (pos[0] == '\n')
+ pos[0] = '\0';
+ dbg("callout returned '%s'", value);
}
}
- dbg("callout returned '%s'", value);
close(fds[0]);
res = wait(&status);
if (res < 0) {