aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/exceptions.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2003-12-27 00:25:02 +0000
committerChristopher Faylor <me@cgf.cx>2003-12-27 00:25:02 +0000
commit56b5feb639f51385da560289e1c1e65512fb3f67 (patch)
tree42bd37417563e78b79eedd998cab0bfe2b9ab685 /winsup/cygwin/exceptions.cc
parent6dc18ca4d35407e4da9b5497f595382aef732f74 (diff)
downloadnewlib-56b5feb639f51385da560289e1c1e65512fb3f67.zip
newlib-56b5feb639f51385da560289e1c1e65512fb3f67.tar.gz
newlib-56b5feb639f51385da560289e1c1e65512fb3f67.tar.bz2
* exceptions.cc (try_to_debug): Fix off-by-one problem when resetting
environment variable after error_start detected. * fhandler_tty_slave.cc (fhandler_tty_slave::close): Clarify debug message. * syscalls.cc (setsid): Don't increment usecount here, since it will be automatically decremented on close.
Diffstat (limited to 'winsup/cygwin/exceptions.cc')
-rw-r--r--winsup/cygwin/exceptions.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc
index 228d2c8..9795530 100644
--- a/winsup/cygwin/exceptions.cc
+++ b/winsup/cygwin/exceptions.cc
@@ -350,12 +350,15 @@ try_to_debug (bool waitloop)
char* rawenv = GetEnvironmentStrings () ;
for (char* p = rawenv; *p != '\0'; p = strchr (p, '\0') + 1)
{
- if (strncmp (p, "CYGWIN=", sizeof ("CYGWIN=") - 1) == 0)
+ if (strncmp (p, "CYGWIN=", strlen ("CYGWIN=")) == 0)
{
char* q = strstr (p, "error_start") ;
/* replace 'error_start=...' with '_rror_start=...' */
- if (q) *q = '_' ;
- SetEnvironmentVariable ("CYGWIN", p + sizeof ("CYGWIN=")) ;
+ if (q)
+ {
+ *q = '_' ;
+ SetEnvironmentVariable ("CYGWIN", p + strlen ("CYGWIN=")) ;
+ }
break ;
}
}