[PATCH] setsid: fix off-by-one error in execvp call

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



E.g. run "ps -j" to see that the SID changed:
  setsid ps -j
The -j option is swallowed due to the +1.

Have a nice day,
Berny

>From 6a3baff2aa7ea3bf387d7805660f668737fe6854 Mon Sep 17 00:00:00 2001
From: Bernhard Voelker <mail@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 6 Jun 2012 16:34:55 +0200
Subject: [PATCH] setsid: fix off-by-one error in execvp call

Bug introduced during --ctty implementation by v2.21-112-g8a2f04d.

Signed-off-by: Bernhard Voelker <mail@xxxxxxxxxxxxxxxxxxx>
---
 sys-utils/setsid.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/sys-utils/setsid.c b/sys-utils/setsid.c
index 52ad38f..071ccc4 100644
--- a/sys-utils/setsid.c
+++ b/sys-utils/setsid.c
@@ -93,6 +93,6 @@ int main(int argc, char **argv)
 		if (ioctl(STDIN_FILENO, TIOCSCTTY, 1))
 			warn(_("failed to set the controlling terminal"));
 	}
-	execvp(argv[optind], argv + optind + 1);
+	execvp(argv[optind], argv + optind);
 	err(EXIT_FAILURE, _("execvp failed"));
 }
-- 
1.7.7


--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux