Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 8 Mar 2016 18:05:20 +0000 (UTC)
From:      Bryan Drewery <bdrewery@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r296525 - head/usr.bin/script
Message-ID:  <201603081805.u28I5KZ1064893@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bdrewery
Date: Tue Mar  8 18:05:20 2016
New Revision: 296525
URL: https://svnweb.freebsd.org/changeset/base/296525

Log:
  Just exit in the child if execve(2) fails.
  
  No functional change.
  
  This is mostly addressing a false-positive from the clang static
  analyzer due to it thinking that done() was being called with freed
  memory, however the kill(0, SIGTERM) made the done() never reached.
  It doesn't make sense to the show the footer from the child anyhow, nor
  does it make sense to kill the process group here since the execve(2)
  failed in the child.  This code was leftover from many years of refactoring.
  
  MFC after:	1 week
  Sponsored by:	EMC / Isilon Storage Division

Modified:
  head/usr.bin/script/script.c

Modified: head/usr.bin/script/script.c
==============================================================================
--- head/usr.bin/script/script.c	Tue Mar  8 18:05:02 2016	(r296524)
+++ head/usr.bin/script/script.c	Tue Mar  8 18:05:20 2016	(r296525)
@@ -80,7 +80,6 @@ static struct termios tt;
 
 static void done(int) __dead2;
 static void doshell(char **);
-static void fail(void);
 static void finish(void);
 static void record(FILE *, char *, size_t, int);
 static void consume(FILE *, off_t, char *, int);
@@ -347,14 +346,7 @@ doshell(char **av)
 		execl(shell, shell, "-i", (char *)NULL);
 		warn("%s", shell);
 	}
-	fail();
-}
-
-static void
-fail(void)
-{
-	(void)kill(0, SIGTERM);
-	done(1);
+	exit(1);
 }
 
 static void



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201603081805.u28I5KZ1064893>