truss issue

From: Alexander Nedotsukov <bland_at_mail.ru>
Date: Mon, 16 Jun 2003 23:40:34 +0900
All,

I found current truss behaviour a bit strange. It coredumps always if 
trussed process do without any significant reason for my understanding. 
I also confused with comment for commit originally introduced this 
functionality 
http://www.freebsd.org/cgi/cvsweb.cgi/src/usr.bin/truss/main.c.diff?r1=1.9&r2=1.10. 
I propose patch attached to make truss always return result of trussed 
process and do not kill() itself. What do you think about it?

All the best,
Alexander.


--- usr.bin/truss/main.c.orig	Mon Jun 16 23:00:35 2003
+++ usr.bin/truss/main.c	Mon Jun 16 23:05:03 2003
_at__at_ -144,7 +144,7 _at__at_
   struct ex_types *funcs;
   int in_exec = 0;
   char *fname = NULL;
-  int sigexit = 0;
+  int rval = 0;
   struct trussinfo *trussinfo;
 
   /* Initialize the trussinfo struct */
_at__at_ -283,10 +283,10 _at__at_
 	break;
       case S_SIG:
 	fprintf(trussinfo->outfile, "SIGNAL %lu\n", pfs.val);
-	sigexit = pfs.val;
 	break;
       case S_EXIT:
 	fprintf (trussinfo->outfile, "process exit, rval = %lu\n", pfs.val);
+	rval = pfs.val;
 	break;
       case S_EXEC:
 	funcs = set_etype(trussinfo);
_at__at_ -305,11 +305,5 _at__at_
     }
   } while (pfs.why != S_EXIT);
   fflush(trussinfo->outfile);
-  if (sigexit) {
-    if (sigexit == SIGQUIT)
-      exit(sigexit);
-    (void) signal(sigexit, SIG_DFL);
-    (void) kill(getpid(), sigexit);
-  }
-  return 0;
+  return rval;
 }
Received on Mon Jun 16 2003 - 05:40:37 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:12 UTC