Ticket #1911: use system realapth(3) function if available.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2010-05-13 21:28:12 +04:00
parent 5ab3f7cb63
commit d2b23924dd
3 changed files with 10 additions and 7 deletions

View File

@ -161,7 +161,8 @@ AC_CHECK_FUNCS([\
memcpy memset \ memcpy memset \
setreuid statfs sysconf \ setreuid statfs sysconf \
tcgetattr tcsetattr truncate \ tcgetattr tcsetattr truncate \
strverscmp strverscmp \
realpath
]) ])
dnl dnl

View File

@ -188,7 +188,11 @@ int mc_mkstemps(char **pname, const char *prefix, const char *suffix);
#define MAXSYMLINKS 32 #define MAXSYMLINKS 32
#endif #endif
char *mc_realpath(const char *path, char resolved_path[]); #ifdef HAVE_REALPATH
#define mc_realpath realpath
#else
char *mc_realpath (const char *path, char *resolved_path);
#endif
enum compression_type { enum compression_type {
COMPRESSION_NONE, COMPRESSION_NONE,

View File

@ -665,12 +665,10 @@ gettimeofday (struct timeval *tp, void *tzp)
} }
#endif /* HAVE_GET_PROCESS_STATS */ #endif /* HAVE_GET_PROCESS_STATS */
#ifndef HAVE_REALPATH
char * char *
mc_realpath (const char *path, char resolved_path[]) mc_realpath (const char *path, char *resolved_path)
{ {
#ifdef USE_SYSTEM_REALPATH
return realpath (path, resolved_path);
#else
char copy_path[PATH_MAX]; char copy_path[PATH_MAX];
char link_path[PATH_MAX]; char link_path[PATH_MAX];
char got_path[PATH_MAX]; char got_path[PATH_MAX];
@ -806,8 +804,8 @@ mc_realpath (const char *path, char resolved_path[])
*new_path = '\0'; *new_path = '\0';
strcpy (resolved_path, got_path); strcpy (resolved_path, got_path);
return resolved_path; return resolved_path;
#endif /* USE_SYSTEM_REALPATH */
} }
#endif /* HAVE_REALPATH */
/* Return the index of the permissions triplet */ /* Return the index of the permissions triplet */
int int