summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorkstailey <kstailey@cvs.openbsd.org>1998-08-24 14:45:34 +0000
committerkstailey <kstailey@cvs.openbsd.org>1998-08-24 14:45:34 +0000
commit1f87b8e8b4d226b86dd90b3ef9f2a9b9311f9f4b (patch)
tree82f911f306f2d6347b4ce74b0643ed272e0a2b34 /usr.bin
parent5d575bc94f93dadc48c4ca3ff17284ef506eb57c (diff)
do not mangle output of realpath()
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/readlink/readlink.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/usr.bin/readlink/readlink.c b/usr.bin/readlink/readlink.c
index ab57186a36f..5e2bfdbdd04 100644
--- a/usr.bin/readlink/readlink.c
+++ b/usr.bin/readlink/readlink.c
@@ -1,5 +1,5 @@
/*
- * $OpenBSD: readlink.c,v 1.17 1998/08/24 14:43:16 kstailey Exp $
+ * $OpenBSD: readlink.c,v 1.18 1998/08/24 14:45:33 kstailey Exp $
*
* Copyright (c) 1997
* Kenneth Stailey (hereinafter referred to as the author)
@@ -72,13 +72,13 @@ main(argc, argv)
exit(1);
}
- if (fflag) {
+ if (fflag)
realpath(argv[0], buf);
- n = strlen(buf);
+ else {
+ if ((n = readlink(argv[0], buf, sizeof buf-1)) < 0)
+ exit(1);
+ buf[n] = '\0';
}
- else if ((n = readlink(argv[0], buf, sizeof buf-1)) < 0)
- exit(1);
- buf[n] = '\0';
printf("%s", buf);
if (!nflag)