Mercurial > hg > xemacs-beta
comparison src/nt.c @ 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 | 902d5bd9b75c |
children | 15139dbf89f4 |
comparison
equal
deleted
inserted
replaced
2956:ee35a8fdcfcd | 2957:5eb04c84c7ae |
---|---|
1 /* Utility and Unix shadow routines under MS Windows (WIN32_NATIVE defined). | 1 /* Utility and Unix shadow routines under MS Windows (WIN32_NATIVE defined). |
2 Copyright (C) 1994, 1995 Free Software Foundation, Inc. | 2 Copyright (C) 1994, 1995 Free Software Foundation, Inc. |
3 Copyright (C) 2000, 2001, 2002, 2004 Ben Wing. | 3 Copyright (C) 2000, 2001, 2002, 2004, 2005 Ben Wing. |
4 | 4 |
5 This file is part of XEmacs. | 5 This file is part of XEmacs. |
6 | 6 |
7 XEmacs is free software; you can redistribute it and/or modify it | 7 XEmacs is free software; you can redistribute it and/or modify it |
8 under the terms of the GNU General Public License as published by the | 8 under the terms of the GNU General Public License as published by the |
832 } | 832 } |
833 | 833 |
834 int | 834 int |
835 mswindows_closedir (DIR *dirp) | 835 mswindows_closedir (DIR *dirp) |
836 { | 836 { |
837 int retval; | 837 int retval = -1; |
838 | 838 |
839 /* If we have a find-handle open, close it. */ | 839 /* If we have a find-handle open, close it. */ |
840 if (dir_find_handle != INVALID_HANDLE_VALUE) | 840 if (dir_find_handle != INVALID_HANDLE_VALUE) |
841 { | 841 { |
842 retval = FindClose (dir_find_handle) ? 0 : -1; | 842 retval = FindClose (dir_find_handle) ? 0 : -1; |
1079 | 1079 |
1080 /* This only works on NTFS volumes, but is useful to have. */ | 1080 /* This only works on NTFS volumes, but is useful to have. */ |
1081 /* #### NT 5.0 has a function CreateHardLink to do this directly, | 1081 /* #### NT 5.0 has a function CreateHardLink to do this directly, |
1082 and it may do more things. */ | 1082 and it may do more things. */ |
1083 int | 1083 int |
1084 mswindows_link (const Ibyte *old, const Ibyte *new) | 1084 mswindows_link (const Ibyte *old, const Ibyte *new_) |
1085 { | 1085 { |
1086 HANDLE fileh; | 1086 HANDLE fileh; |
1087 int result = -1; | 1087 int result = -1; |
1088 Extbyte *oldext; | 1088 Extbyte *oldext; |
1089 | 1089 |
1090 if (old == NULL || new == NULL) | 1090 if (old == NULL || new_ == NULL) |
1091 { | 1091 { |
1092 errno = ENOENT; | 1092 errno = ENOENT; |
1093 return -1; | 1093 return -1; |
1094 } | 1094 } |
1095 | 1095 |
1112 { | 1112 { |
1113 WIN32_STREAM_ID wid; | 1113 WIN32_STREAM_ID wid; |
1114 WCHAR wbuffer[_MAX_PATH]; /* extra space for link name */ | 1114 WCHAR wbuffer[_MAX_PATH]; /* extra space for link name */ |
1115 } data; | 1115 } data; |
1116 | 1116 |
1117 TO_EXTERNAL_FORMAT (C_STRING, new, | 1117 TO_EXTERNAL_FORMAT (C_STRING, new_, |
1118 ALLOCA, (newuni, wlen), Qmswindows_unicode); | 1118 ALLOCA, (newuni, wlen), Qmswindows_unicode); |
1119 if (wlen / sizeof (WCHAR) < _MAX_PATH) | 1119 if (wlen / sizeof (WCHAR) < _MAX_PATH) |
1120 { | 1120 { |
1121 LPVOID context = NULL; | 1121 LPVOID context = NULL; |
1122 DWORD wbytes = 0; | 1122 DWORD wbytes = 0; |