From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kay Sievers Date: Mon, 15 Dec 2003 01:32:20 +0000 Subject: [udev] remove '\n' from end of callout return MIME-Version: 1 Content-Type: multipart/mixed; boundary="k1lZvvs/B4yU6o8G" Message-Id: List-Id: References: In-Reply-To: To: linux-hotplug@vger.kernel.org --k1lZvvs/B4yU6o8G Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Uups, new mail. It's better to attach the promised file :) Attached is a patch to remove a possible newline from the end of the callout returned string. So we can use "echo" instead of "echo -n" in a callout script, to match with ID= thanks, Kay 03-remove-newline-from-callout-return.diff remove possible newline at end of callout output, for easier matching with ID= --k1lZvvs/B4yU6o8G Content-Type: text/plain; charset=us-ascii Content-Disposition: inline; filename="03-remove-newline-from-callout-return.diff" diff -Nru a/namedev.c b/namedev.c --- a/namedev.c Mon Dec 15 02:22:46 2003 +++ b/namedev.c Mon Dec 15 02:22:46 2003 @@ -266,6 +266,7 @@ char buffer[256]; char *arg; char *args[CALLOUT_MAXARG]; + char *pos; int i; dbg("callout to '%s'", dev->exec_program); @@ -326,6 +327,9 @@ strncpy(value, buffer, len); } } + pos = value + strlen(value)-1; + if (pos[0] == '\n') + pos[0] = '\0'; dbg("callout returned '%s'", value); close(fds[0]); res = wait(&status); --k1lZvvs/B4yU6o8G-- ------------------------------------------------------- This SF.net email is sponsored by: IBM Linux Tutorials. Become an expert in LINUX or just sharpen your skills. Sign up for IBM's Free Linux Tutorials. Learn everything from the bash shell to sys admin. Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net Linux-hotplug-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel