Mail Archives: djgpp-workers/2002/09/24/20:18:37
This updates _fixpath to reflect that errno may be set.
Index: fixpath.txh
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/posix/sys/stat/fixpath.txh,v
retrieving revision 1.4
diff -c -p -r1.4 fixpath.txh
*** fixpath.txh 20 Jul 2000 07:16:39 -0000 1.4
--- fixpath.txh 25 Sep 2002 00:15:43 -0000
*************** caller should ensure there is enough spa
*** 30,36 ****
@subheading Return Value
! None.
@subheading Portability
--- 30,37 ----
@subheading Return Value
! None. If the length of the returned path name exceeds @code{FILENAME_MAX},
! @code{errno} is set to @code{ENAMETOOLONG}.
@subheading Portability
And the realpath wrapper:
/* Copyright (C) 2002 DJ Delorie, see COPYING.DJ for details */
#include <libc/stubs.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <unistd.h>
#include <limits.h>
#include <libc/symlink.h>
/* Return the canonicalized form of the path in variable IN. */
char *
realpath(const char *in, char *out)
{
char in1[PATH_MAX];
if (in == NULL || out == NULL)
{
errno = EINVAL;
return NULL;
}
if (in[0] == '\0')
{
errno = ENOENT;
return NULL;
}
if (!__solve_symlinks(in, in1))
return NULL; /* Return errno from from __solve_dir_symlinks(). */
if (__canonicalize_path(in1, out, PATH_MAX) == NULL)
return NULL; /* Return errno from __canonicalize_path(). */
return out;
}
- Raw text -