mirror of
https://git.openafs.org/openafs.git
synced 2025-01-18 15:00:12 +00:00
fs: Avoid unnecessary lstat() for -literal
Currently, GetLastComponent() always stats (lstat) the file received as an argument. However, the status information about this file is only used when 'literal' is false. That said, skip lstat() when 'literal' is true. While here, zero out 'statbuff' at the beginning of GetLastComponent() just to make sure it won't be used uninitialized in the future. Change-Id: I3f332c53ae688d6f74276bcdbf2f9f61605ec9ad Reviewed-on: https://gerrit.openafs.org/14840 Reviewed-by: Mark Vitale <mvitale@sinenomine.net> Reviewed-by: Cheyenne Wills <cwills@sinenomine.net> Reviewed-by: Andrew Deason <adeason@sinenomine.net> Reviewed-by: Michael Meffie <mmeffie@sinenomine.net> Tested-by: BuildBot <buildbot@rampaginggeek.com>
This commit is contained in:
parent
5b01ee836d
commit
a0852d93e5
@ -1743,6 +1743,7 @@ GetLastComponent(const char *data, char **outdir, char **outbase,
|
||||
|
||||
*outbase = NULL;
|
||||
*outdir = NULL;
|
||||
memset(&statbuff, 0, sizeof(statbuff));
|
||||
|
||||
if (thru_symlink)
|
||||
*thru_symlink = 0;
|
||||
@ -1750,7 +1751,7 @@ GetLastComponent(const char *data, char **outdir, char **outbase,
|
||||
snprintf(orig_name, sizeof(orig_name), "%s%s",
|
||||
(data[0] == '/') ? "" : "./", data);
|
||||
|
||||
if (lstat(orig_name, &statbuff) < 0) {
|
||||
if (!literal && lstat(orig_name, &statbuff) < 0) {
|
||||
/* if lstat fails, we should still try the pioctl, since it
|
||||
* may work (for example, lstat will fail, but pioctl will
|
||||
* work if the volume of offline (returning ENODEV). */
|
||||
|
Loading…
Reference in New Issue
Block a user