* path.cc (readlink): Avoid calling strlen() twice.

This commit is contained in:
Corinna Vinschen
2012-03-08 14:56:18 +00:00
parent 34903c1c25
commit efb1f061f1
2 changed files with 6 additions and 1 deletions

View File

@@ -2783,7 +2783,8 @@ readlink (const char *path, char *buf, size_t buflen)
return -1;
}
ssize_t len = MIN (buflen, strlen (pathbuf.get_win32 ()));
size_t pathbuf_len = strlen (pathbuf.get_win32 ());
ssize_t len = MIN (buflen, pathbuf_len);
memcpy (buf, pathbuf.get_win32 (), len);
/* errno set by symlink.check if error */