Mail Archives: djgpp-workers/1997/05/25/11:20:53
The previous patch to `pathconf' didn't look at $LFN in the environment,
and so would cause a program that used its info to fail when LFN is set
to N on Windows 95. This patch (relative to original v2.01 sources)
corrects that bug:
*** src/libc/posix/unistd/pathconf.c~0 Sun Apr 2 00:25:52 1995
--- src/libc/posix/unistd/pathconf.c Sun May 25 17:37:36 1997
***************
*** 1,8 ****
--- 1,14 ----
+ /* Copyright (C) 1997 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#include <errno.h>
+ #include <stdlib.h>
+ #include <ctype.h>
#include <unistd.h>
+ #include <fcntl.h>
#include <limits.h>
+ #define TOLOWER(c) (isascii(c) && isupper(c) ? tolower (c) : (c))
+
long
pathconf(const char *path, int name)
{
*************** pathconf(const char *path, int name)
*** 11,18 ****
case _PC_LINK_MAX: return LINK_MAX;
case _PC_MAX_CANON: return MAX_CANON;
case _PC_MAX_INPUT: return MAX_INPUT;
! case _PC_NAME_MAX: return NAME_MAX;
! case _PC_PATH_MAX: return PATH_MAX;
case _PC_PIPE_BUF: return PIPE_BUF;
case _PC_CHOWN_RESTRICTED: return _POSIX_CHOWN_RESTRICTED;
case _PC_NO_TRUNC: return _POSIX_NO_TRUNC;
--- 17,40 ----
case _PC_LINK_MAX: return LINK_MAX;
case _PC_MAX_CANON: return MAX_CANON;
case _PC_MAX_INPUT: return MAX_INPUT;
! case _PC_NAME_MAX: case _PC_PATH_MAX:
! {
! int name_max, path_max;
! int e = errno;
! char *lfnenv = getenv ("LFN");
!
! if (!lfnenv || TOLOWER (*lfnenv) != 'n')
! {
! errno = 0;
! _get_volume_info (path, &name_max, &path_max, 0);
! if (!errno)
! {
! errno = e;
! return (name == _PC_NAME_MAX) ? name_max : path_max;
! }
! }
! return (name == _PC_NAME_MAX) ? NAME_MAX : PATH_MAX;
! }
case _PC_PIPE_BUF: return PIPE_BUF;
case _PC_CHOWN_RESTRICTED: return _POSIX_CHOWN_RESTRICTED;
case _PC_NO_TRUNC: return _POSIX_NO_TRUNC;
- Raw text -