diff options
author | grr <grr@cvs.openbsd.org> | 1997-06-28 04:56:50 +0000 |
---|---|---|
committer | grr <grr@cvs.openbsd.org> | 1997-06-28 04:56:50 +0000 |
commit | 5f1d9baea176a902331941463f36c7725258bc7f (patch) | |
tree | 9c961bdb15645f6888677f0fcac1f1f05e3abcf3 /usr.bin | |
parent | 3e580218b3be6fc3917b59f4b0701fbc4e8586e9 (diff) |
RTFM
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/readlink/readlink.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.bin/readlink/readlink.c b/usr.bin/readlink/readlink.c index 26d81e2afb8..7be4c22fe1e 100644 --- a/usr.bin/readlink/readlink.c +++ b/usr.bin/readlink/readlink.c @@ -1,5 +1,5 @@ /* - * $OpenBSD: readlink.c,v 1.3 1997/06/20 12:18:57 kstailey Exp $ + * $OpenBSD: readlink.c,v 1.4 1997/06/28 04:56:49 grr Exp $ * * Copyright (c) 1997 * Kenneth Stailey (hereinafter referred to as the author) @@ -38,13 +38,15 @@ int argc; char **argv; { char buf[PATH_MAX]; + int n; if (argc != 2) errx(1, "usage: readlink symlink"); - if (readlink(argv[1], buf, PATH_MAX) < 0) + if ((n = readlink(argv[1], buf, PATH_MAX)) < 0) exit(1); - else - printf("%s", buf); + + buf[n] = '\0'; + printf("%s", buf); exit(0); } |