#include <errno.h>
#include <assert.h>
#include <sys/types.h>
+#include <sys/stat.h>
#include <sys/queue.h>
#include "sysio.h"
if (err)
goto out;
ino = pno->p_base->pb_ino;
- err = (*ino->i_ops.inop_readlink)(pno, buf, bufsiz);
- if (err)
+ if (!S_ISLNK(ino->i_stbuf.st_mode)) {
+ err = -EINVAL;
goto error;
-
+ }
+ err = (*ino->i_ops.inop_readlink)(pno, buf, bufsiz);
error:
P_RELE(pno);
out:
- SYSIO_INTERFACE_RETURN(err, err >= 0 ? 0 : err);
+ SYSIO_INTERFACE_RETURN(err < 0 ? -1 : err, err >= 0 ? 0 : err);
}
#ifdef REDSTORM