aklog: Fix segfault on aklog -path

Commit 2fac53522e “aklog: Fix improper
use of readlink” inadvertently changed the meaning of int link from a
boolean flag (length > 0) to just a length.  This caused ‘aklog -path
(anything)’ to segfault.

Update the type of link and the condition of the while loop to account
for this change.

FIXES 131930

Change-Id: Ia05836795425a53e858ab29866900f6d45970644
Reviewed-on: http://gerrit.openafs.org/11517
Reviewed-by: Anders Kaseorg <andersk@mit.edu>
Tested-by: Anders Kaseorg <andersk@mit.edu>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Tested-by: Stephan Wiesand <stephan.wiesand@desy.de>
Reviewed-by: D Brashear <shadow@your-file-system.com>
This commit is contained in:
Anders Kaseorg 2014-09-30 13:52:31 -04:00 committed by D Brashear
parent c6b61a4510
commit fbea3265b3

View File

@ -1166,7 +1166,7 @@ next_path(char *origpath)
static char path[MAXPATHLEN + 1];
static char pathtocheck[MAXPATHLEN + 1];
int link = FALSE; /* Is this a symbolic link? */
ssize_t link; /* Return value from readlink */
char linkbuf[MAXPATHLEN + 1];
char tmpbuf[MAXPATHLEN + 1];
@ -1244,7 +1244,7 @@ next_path(char *origpath)
else
last_comp = elast_comp;
}
while(link);
while(link > 0);
return(pathtocheck);
}