From 6dbfb93a04322cfb0320210b7a6c0bbd8c36548b Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Wed, 11 Feb 2004 00:29:42 +0000 Subject: [PATCH] * strace.cc (main): Guard against previous setting of POSIXLY_CORRECT. --- winsup/utils/ChangeLog | 4 ++++ winsup/utils/strace.cc | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/winsup/utils/ChangeLog b/winsup/utils/ChangeLog index 4609834aa..672e9af83 100644 --- a/winsup/utils/ChangeLog +++ b/winsup/utils/ChangeLog @@ -1,3 +1,7 @@ +2004-02-10 Christopher Faylor + + * strace.cc (main): Guard against previous setting of POSIXLY_CORRECT. + 2004-02-10 Christopher Faylor * strace.cc: Update copyrights. diff --git a/winsup/utils/strace.cc b/winsup/utils/strace.cc index 4511b90ac..df420240d 100644 --- a/winsup/utils/strace.cc +++ b/winsup/utils/strace.cc @@ -903,13 +903,15 @@ main (int argc, char **argv) pid_t pid = 0; int opt; int toggle = 0; + int posixly_correct_set = getenv ("POSIXLY_CORRECT") != NULL; if (!(pgm = strrchr (*argv, '\\')) && !(pgm = strrchr (*argv, '/'))) pgm = *argv; else pgm++; - (void) putenv("POSIXLY_CORRECT=1"); + if (!posixly_correct_set) + (void) putenv("POSIXLY_CORRECT=1"); while ((opt = getopt_long (argc, argv, opts, longopts, NULL)) != EOF) switch (opt) { @@ -994,6 +996,8 @@ character #%d.\n", optarg, (int) (endptr - optarg), endptr); if (!ofile) ofile = stdout; + if (!posixly_correct_set) + putenv ("POSIXLY_CORRECT="); if (toggle) dotoggle (pid); else