Mercurial > hg > xemacs-beta
changeset 2957:5eb04c84c7ae
[xemacs-hg @ 2005-09-27 05:32:19 by ben]
[21.4] Fix bugs in nt.c, sysdep.c
sysdep.c: Fix bit-rotted dup2 code. Also new -> new_.
nt.c: Fix possible use of uninitialized var. Also new -> new_.
author | ben |
---|---|
date | Tue, 27 Sep 2005 05:32:22 +0000 |
parents | ee35a8fdcfcd |
children | 9e04ad6a1ac6 |
files | src/ChangeLog src/nt.c src/sysdep.c |
diffstat | 3 files changed, 34 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog Tue Sep 27 05:29:45 2005 +0000 +++ b/src/ChangeLog Tue Sep 27 05:32:22 2005 +0000 @@ -1,3 +1,15 @@ +2005-09-27 Ben Wing <ben@xemacs.org> + + * sysdep.c (emacs_set_tty): + * sysdep.c (qxe_link): + * sysdep.c (qxe_rename): + * sysdep.c (dup2): + Fix bit-rotted dup2 code. Also new -> new_. + * nt.c: + * nt.c (mswindows_closedir): + * nt.c (mswindows_link): + Fix possible use of uninitialized var. Also new -> new_. + 2005-09-27 Ben Wing <ben@xemacs.org> * text.c (wcscmp_ascii):
--- a/src/nt.c Tue Sep 27 05:29:45 2005 +0000 +++ b/src/nt.c Tue Sep 27 05:32:22 2005 +0000 @@ -1,6 +1,6 @@ /* Utility and Unix shadow routines under MS Windows (WIN32_NATIVE defined). Copyright (C) 1994, 1995 Free Software Foundation, Inc. - Copyright (C) 2000, 2001, 2002, 2004 Ben Wing. + Copyright (C) 2000, 2001, 2002, 2004, 2005 Ben Wing. This file is part of XEmacs. @@ -834,7 +834,7 @@ int mswindows_closedir (DIR *dirp) { - int retval; + int retval = -1; /* If we have a find-handle open, close it. */ if (dir_find_handle != INVALID_HANDLE_VALUE) @@ -1081,13 +1081,13 @@ /* #### NT 5.0 has a function CreateHardLink to do this directly, and it may do more things. */ int -mswindows_link (const Ibyte *old, const Ibyte *new) +mswindows_link (const Ibyte *old, const Ibyte *new_) { HANDLE fileh; int result = -1; Extbyte *oldext; - if (old == NULL || new == NULL) + if (old == NULL || new_ == NULL) { errno = ENOENT; return -1; @@ -1114,7 +1114,7 @@ WCHAR wbuffer[_MAX_PATH]; /* extra space for link name */ } data; - TO_EXTERNAL_FORMAT (C_STRING, new, + TO_EXTERNAL_FORMAT (C_STRING, new_, ALLOCA, (newuni, wlen), Qmswindows_unicode); if (wlen / sizeof (WCHAR) < _MAX_PATH) {
--- a/src/sysdep.c Tue Sep 27 05:29:45 2005 +0000 +++ b/src/sysdep.c Tue Sep 27 05:32:22 2005 +0000 @@ -1458,19 +1458,19 @@ } else { - struct termios new; + struct termios new_; /* Get the current settings, and see if they're what we asked for. */ - tcgetattr (fd, &new); + tcgetattr (fd, &new_); /* We cannot use memcmp on the whole structure here because under * aix386 the termios structure has some reserved field that may * not be filled in. */ - if ( new.c_iflag == settings->main.c_iflag - && new.c_oflag == settings->main.c_oflag - && new.c_cflag == settings->main.c_cflag - && new.c_lflag == settings->main.c_lflag - && memcmp(new.c_cc, settings->main.c_cc, NCCS) == 0) + if ( new_.c_iflag == settings->main.c_iflag + && new_.c_oflag == settings->main.c_oflag + && new_.c_cflag == settings->main.c_cflag + && new_.c_lflag == settings->main.c_lflag + && memcmp(new_.c_cc, settings->main.c_cc, NCCS) == 0) break; else continue; @@ -3293,28 +3293,28 @@ #if defined (HAVE_LINK) int -qxe_link (const Ibyte *existing, const Ibyte *new) +qxe_link (const Ibyte *existing, const Ibyte *new_) { #ifdef WIN32_NATIVE - return mswindows_link (existing, new); + return mswindows_link (existing, new_); #else /* not WIN32_NATIVE */ Extbyte *existingout, *newout; PATHNAME_CONVERT_OUT (existing, existingout); - PATHNAME_CONVERT_OUT (new, newout); + PATHNAME_CONVERT_OUT (new_, newout); return link (existingout, newout); #endif /* WIN32_NATIVE */ } #endif /* defined (HAVE_LINK) */ int -qxe_rename (const Ibyte *old, const Ibyte *new) +qxe_rename (const Ibyte *old, const Ibyte *new_) { #ifdef WIN32_NATIVE - return mswindows_rename (old, new); + return mswindows_rename (old, new_); #else /* not WIN32_NATIVE */ Extbyte *oldout, *newout; PATHNAME_CONVERT_OUT (old, oldout); - PATHNAME_CONVERT_OUT (new, newout); + PATHNAME_CONVERT_OUT (new_, newout); return rename (oldout, newout); #endif /* WIN32_NATIVE */ } @@ -3594,12 +3594,12 @@ signal_ferror_with_frob (Qfile_error, lisp_strerror (errno), "can't dup2 (%i, %i)", oldd, newd); #else - fd = dup (old); + fd = dup (oldd); if (fd == -1) return -1; - if (fd == new) - return new; - ret = dup2 (old, new); + if (fd == newd) + return newd; + ret = dup2 (oldd, newd); retry_close (fd); return ret; #endif /* F_DUPFD */