int
sys_rmdir (const char * path)
{
- return _rmdir (map_w32_filename (path, NULL));
+ path = map_w32_filename (path, NULL);
+
+ if (w32_unicode_filenames)
+ {
+ wchar_t path_w[MAX_PATH];
+
+ filename_to_utf16 (path, path_w);
+ return _wrmdir (path_w);
+ }
+ else
+ {
+ char path_a[MAX_PATH];
+
+ filename_to_ansi (path, path_a);
+ return _rmdir (path_a);
+ }
}
int
{
path = map_w32_filename (path, NULL);
- /* On Unix, unlink works without write permission. */
- _chmod (path, 0666);
- return _unlink (path);
+ if (w32_unicode_filenames)
+ {
+ wchar_t path_w[MAX_PATH];
+
+ filename_to_utf16 (path, path_w);
+ /* On Unix, unlink works without write permission. */
+ _wchmod (path_w, 0666);
+ return _wunlink (path_w);
+ }
+ else
+ {
+ char path_a[MAX_PATH];
+
+ filename_to_ansi (path, path_a);
+ _chmod (path_a, 0666);
+ return _unlink (path_a);
+ }
}
static FILETIME utc_base_ft;
OVERLAPPED ovl_read;
/* Used for async write operations on serial comm ports. */
OVERLAPPED ovl_write;
- /* Input file, if any, for this subprocess. Should only be non-NULL
- for async subprocesses. */
- char *input_file;
- /* If non-zero, the subprocess input file is temporary and should be
- deleted when the subprocess exits. */
- int pending_deletion;
} child_process;
#define MAXDESC FD_SETSIZE
extern void set_process_dir (char *);
extern int sys_spawnve (int, char *, char **, char **);
extern void register_child (pid_t, int);
-extern void record_infile (pid_t, char *);
-extern void record_pending_deletion (char *);
extern void sys_sleep (int);
extern int sys_link (const char *, const char *);
cp->pid = -1;
cp->procinfo.hProcess = NULL;
cp->status = STATUS_READ_ERROR;
- cp->input_file = NULL;
- cp->pending_deletion = 0;
/* use manual reset event so that select() will function properly */
cp->char_avail = CreateEvent (NULL, TRUE, FALSE, NULL);
if (!CHILD_ACTIVE (cp) && cp->procinfo.hProcess == NULL)
return;
- /* Delete the child's temporary input file, if any, that is pending
- deletion. */
- if (cp->input_file)
- {
- if (cp->pending_deletion)
- {
- if (unlink (cp->input_file))
- DebPrint (("delete_child.unlink (%s) failed, errno: %d\n",
- cp->input_file, errno));
- cp->pending_deletion = 0;
- }
- xfree (cp->input_file);
- cp->input_file = NULL;
- }
-
/* reap thread if necessary */
if (cp->thrd)
{
fd_info[fd].cp = cp;
}
-/* Record INFILE as an input file for process PID. */
-void
-record_infile (pid_t pid, char *infile)
-{
- child_process *cp;
-
- /* INFILE should never be NULL, since xstrdup would have signaled
- memory full condition in that case, see callproc.c where this
- function is called. */
- eassert (infile);
-
- cp = find_child_pid ((DWORD)pid);
- if (cp == NULL)
- {
- DebPrint (("record_infile is unable to find pid %lu\n", pid));
- return;
- }
-
- cp->input_file = infile;
-}
-
-/* Mark the input file INFILE of the corresponding subprocess as
- temporary, to be deleted when the subprocess exits. */
-void
-record_pending_deletion (char *infile)
-{
- child_process *cp;
-
- eassert (infile);
-
- for (cp = child_procs + (child_proc_count-1); cp >= child_procs; cp--)
- if (CHILD_ACTIVE (cp)
- && cp->input_file && xstrcasecmp (cp->input_file, infile) == 0)
- {
- cp->pending_deletion = 1;
- break;
- }
-}
-
/* Called from waitpid when a process exits. */
static void
reap_subprocess (child_process *cp)