summaryrefslogtreecommitdiff
path: root/sudo_realpath.c
diff options
context:
space:
mode:
authorTodd C. Miller <Todd.Miller@courtesan.com>1995-03-24 03:32:53 +0000
committerTodd C. Miller <Todd.Miller@courtesan.com>1995-03-24 03:32:53 +0000
commit990b26b599f47fd9feab3eeff57f9b491bba1b8d (patch)
tree8874954911eba305693beaa1cb47b47871ff335f /sudo_realpath.c
parent1b16e8235e64ac3d90a3ddc75da9569cefd15c32 (diff)
downloadsudo-990b26b599f47fd9feab3eeff57f9b491bba1b8d.tar.gz
merged in utk changes
Diffstat (limited to 'sudo_realpath.c')
-rw-r--r--sudo_realpath.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/sudo_realpath.c b/sudo_realpath.c
index 753895e99..40db05a92 100644
--- a/sudo_realpath.c
+++ b/sudo_realpath.c
@@ -94,6 +94,7 @@ char * sudo_realpath(old, new)
struct stat statbuf; /* for lstat() */
char * temp; /* temporary ptr */
int len; /* length parameter */
+ int err; /* did we get an error? */
/* check for brain damage */
if (old == NULL || old[0] == '\0')
@@ -105,6 +106,12 @@ char * sudo_realpath(old, new)
/* we need to be root for this section */
set_perms(PERM_ROOT);
+#ifndef USE_REALPATH
+ err = stat(new, &statbuf);
+ set_perms(PERM_USER);
+ return((err == 0) ? new : NULL);
+#endif /* USE_REALPATH */
+
/*
* Resolve the last component of the path if it is a link
* until it is a non-link.