> -----Original Message-----
> From: Andrew Black [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, August 23, 2006 12:02 AM
> To: [email protected]
> Subject: Re: [PATCH] exec utility patch
>
> The first observation I have is that there is a certain
> amount of 'noise' in the patch from spelling corrections in
> comments. These spelling fixes should probably be submitted
> as a separate cleanup patch.
That is VisualAssist plugin for VisualStudio underlines with red
color the incorrect words and I corrected that words to not see them.
I have disabled spelling feature for now.
>
> The second observation I have is about the use of get_signame
> on the SIGSEGV constant. It would be more efficient to use
> 'puts (" SEGV\n")
> ;' rather than calling printf on a function that returns
> what is essentially a constant. An additional benefit is
> that you wouldn't need to include signal.h.
Agreed. Corrected patch is attached.
Farid.
Index: exec.cpp
===================================================================
--- exec.cpp (revision 433977)
+++ exec.cpp (working copy)
@@ -930,6 +930,11 @@
merged = merge_argv (argv);
+ /* set appropriate error mode (the child process inherits this
+ error mode) to disable displaying the critical-error-handler
+ and general-protection-fault message boxes */
+ UINT old_mode = SetErrorMode (SEM_FAILCRITICALERRORS
+ | SEM_NOGPFAULTERRORBOX);
/* Create the child process */
if (0 == CreateProcess (argv [0], merged, 0, 0, 1,
CREATE_NEW_PROCESS_GROUP, 0, 0, &context, &child)) {
@@ -938,6 +943,9 @@
status.error = warn_last_error ("Creating child process");;
}
+ /* restore the previous error mode */
+ SetErrorMode (old_mode);
+
/* Clean up handles */
if (context.hStdInput)
if (0 == CloseHandle (context.hStdInput))
Index: runall.cpp
===================================================================
--- runall.cpp (revision 433977)
+++ runall.cpp (working copy)
@@ -35,6 +35,8 @@
#include <sys/stat.h>
#if !defined (_WIN32) && !defined (_WIN64)
# include <sys/wait.h> /* for WIFEXITED(), ... */
+#else
+# include <windows.h> /* for STATUS_ACCESS_VIOLATION */
#endif
#include "cmdopt.h"
@@ -350,6 +352,8 @@
puts (" I/O");
else if (result->error)
puts ("KILLED");
+ else if (STATUS_ACCESS_VIOLATION == result->status)
+ puts (" SEGV");
else
printf ("%6d\n", result->status);
#endif /* _WIN{32,64} */