This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
-/* Array of file descriptors opened. If it points to a directory, it stores
- info about this directory. */
+/* Array of file descriptors opened. If REPLACE_OPEN_DIRECTORY or if it points
+ to a directory, it stores info about this directory. */
-/* Try to ensure dirs has enough room for a slot at index fd. Return
- false and set errno to ENOMEM on allocation failure. */
+/* Try to ensure dirs has enough room for a slot at index fd; free any
+ contents already in that slot. Return false and set errno to
+ ENOMEM on allocation failure. */
- (dirs != NULL
- ? (dir_info_t *) realloc (dirs, new_allocated * sizeof *dirs)
- : (dir_info_t *) malloc (new_allocated * sizeof *dirs));
+ (dirs != NULL
+ ? (dir_info_t *) realloc (dirs, new_allocated * sizeof *dirs)
+ : (dir_info_t *) malloc (new_allocated * sizeof *dirs));
if (REPLACE_OPEN_DIRECTORY || !HAVE_CANONICALIZE_FILE_NAME)
{
/* The function canonicalize_file_name has not yet been ported
if (REPLACE_OPEN_DIRECTORY || !HAVE_CANONICALIZE_FILE_NAME)
{
/* The function canonicalize_file_name has not yet been ported
- to mingw, with all its drive letter and backslash quirks.
- Fortunately, getcwd is reliable in this case, but we ensure
- we can get back to where we started before using it. Treat
- "." as a special case, as it is frequently encountered. */
+ to mingw, with all its drive letter and backslash quirks.
+ Fortunately, getcwd is reliable in this case, but we ensure
+ we can get back to where we started before using it. Treat
+ "." as a special case, as it is frequently encountered. */
char *cwd = getcwd (NULL, 0);
int saved_errno;
if (dir[0] == '.' && dir[1] == '\0')
char *cwd = getcwd (NULL, 0);
int saved_errno;
if (dir[0] == '.' && dir[1] == '\0')
and fcntl. Both arguments must be valid and distinct file
descriptors. Close NEWFD and return -1 if OLDFD is tracking a
directory, but there is insufficient memory to track the same
and fcntl. Both arguments must be valid and distinct file
descriptors. Close NEWFD and return -1 if OLDFD is tracking a
directory, but there is insufficient memory to track the same
/* Return stat information about FD in STATBUF. Needed when
rpl_open() used a dummy file to work around an open() that can't
normally visit directories. */
/* Return stat information about FD in STATBUF. Needed when
rpl_open() used a dummy file to work around an open() that can't
normally visit directories. */