NOTE: This patch has been committed.
src/ChangeLog addition:
2005-09-27 Ben Wing <ben(a)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_.
build source patch:
Diff command: bash -ci "cvs-diff --show-c-function -no-changelog "
Files affected: src/nt.c src/sysdep.c
Tue Sep 27 00:30:33 CDT 2005
Index: src/sysdep.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/sysdep.c,v
retrieving revision 1.82
diff -u -p -r1.82 sysdep.c
--- src/sysdep.c 2005/06/26 18:05:05 1.82
+++ src/sysdep.c 2005/09/27 05:30:57
@@ -1458,19 +1458,19 @@ emacs_set_tty (int fd, struct emacs_tty
}
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 @@ qxe_chmod (const Ibyte *path, mode_t mod
#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 @@ dup2 (int oldd, int newd)
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 */
Index: src/nt.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/nt.c,v
retrieving revision 1.46
diff -u -p -r1.46 nt.c
--- src/nt.c 2005/01/28 02:36:25 1.46
+++ src/nt.c 2005/09/27 05:30:59
@@ -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 @@ mswindows_opendir (const Ibyte *filename
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 @@ mswindows_access (const Ibyte *path, int
/* #### 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 @@ mswindows_link (const Ibyte *old, const
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)
{