1
0
mirror of https://github.com/openbsd/src.git synced 2025-01-10 06:47:55 -08:00
This commit is contained in:
grr 1997-06-28 04:56:49 +00:00
parent 066e68fa40
commit deef5b56ec

View File

@ -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);
}