mirror of
git://git.sv.gnu.org/findutils.git
synced 2026-01-29 12:58:55 +01:00
For the %h format, don't bail out early as the format might contain
something else too.
This commit is contained in:
21
find/pred.c
21
find/pred.c
@@ -635,14 +635,23 @@ pred_fprintf (char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
|
||||
case 'h': /* leading directories part of path */
|
||||
{
|
||||
char cc;
|
||||
|
||||
|
||||
cp = strrchr (pathname, '/');
|
||||
if (cp == NULL) /* No leading directories. */
|
||||
break;
|
||||
cc = *cp;
|
||||
*cp = '\0';
|
||||
fprintf (fp, segment->text, pathname);
|
||||
*cp = cc;
|
||||
{
|
||||
/* If there is no slash in the pathname, we still
|
||||
* print the string because it contains characters
|
||||
* other than just '%s'.
|
||||
*/
|
||||
fprintf (fp, segment->text, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
cc = *cp;
|
||||
*cp = '\0';
|
||||
fprintf (fp, segment->text, pathname);
|
||||
*cp = cc;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'H': /* ARGV element file was found under */
|
||||
|
||||
Reference in New Issue
Block a user