Skip to contentSkip to conversation

setsid: fix off-by-one error in execvp call

PATCH Applied Bernhard Voelker 2 participants 2 messages Jun 6, 2012 – Jun 15, 2012 Util-Linux package

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 setsid: fix off-by-one error in execvp call

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

Quoted 1 line

From 6a3baff2aa7ea3bf387d7805660f668737fe6854 Mon Sep 17 00:00:00 2001

From: Bernhard Voelker <[email protected]>
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.

---
 sys-utils/setsid.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
sys-utils/setsid.c +1 -1
index 52ad38f..071ccc4 100644
@@ -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"));
 }
Signature · 1 line
1.7.7
maintainer Applied
#1 lore raw
Quoted 2 lines · Bernhard Voelker
 sys-utils/setsid.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Applied, thanks.

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com