void print_stat_cache_statistics(void)
{
- double eff = (100.0* (double)global_stat_cache_hits)/(double)global_stat_cache_lookups;
+ double eff;
+
+ if(global_stat_cache_lookups == 0)
+ return;
+
+ eff = (100.0* (double)global_stat_cache_hits)/(double)global_stat_cache_lookups;
DEBUG(0,("stat cache stats: lookups = %d, hits = %d, misses = %d, \
stat cache was %f%% effective.\n", global_stat_cache_lookups,
BOOL *bad_path, SMB_STRUCT_STAT *pst)
{
SMB_STRUCT_STAT st;
- char *start, *end, *orig_start;
+ char *start, *end;
pstring dirpath;
pstring orig_path;
- int saved_errno;
BOOL component_was_mangled = False;
BOOL name_has_wildcard = False;
#if 0
extern char magic_char;
#endif
+ DEBUG(5, ("unix_convert called on file \"%s\"\n", name));
+
*dirpath = 0;
*bad_path = False;
if(pst) {
trim_string(name,"/","/");
- /* I've disabled this till we fix printing (probably a getatr problem) (tridge) */
-#if TRIM_NULL_NAMES
/*
* If we trimmed down to a single '\0' character
* then we should use the "." directory to avoid
- * searching the cache.
+ * searching the cache, but not if we are in a
+ * printing share.
*/
- if(!*name) {
+ if (!*name && (!conn -> printer)) {
name[0] = '.';
name[1] = '\0';
}
-#endif
/*
* Ensure saved_last_component is valid even if file exists.
for (s=name2 ; *s ; s++)
if (!issafe(*s)) *s = '_';
- pstrcpy(name,(char *)mktemp(name2));
+ pstrcpy(name,(char *)smbd_mktemp(name2));
}
return(True);
}
+ /*
+ * If we trimmed down to a single '\0' character
+ * then we will be using the "." directory.
+ * As we know this is valid we can return true here.
+ */
+
+ if(!*name)
+ return(True);
+
start = name;
while (strncmp(start,"./",2) == 0)
start += 2;
return(True);
}
- saved_errno = errno;
-
DEBUG(5,("unix_convert begin: name = %s, dirpath = %s, start = %s\n",
name, dirpath, start));
*/
if (case_sensitive && !is_mangled(name) &&
- !lp_strip_dot() && !use_mangled_map && (saved_errno != ENOENT))
+ !lp_strip_dot() && !use_mangled_map)
return(False);
if(strchr(start,'?') || strchr(start,'*'))
* as is first, then trying to scan the directory for matching names.
*/
- for (orig_start = start; start ; start = (end?end+1:(char *)NULL)) {
+ for (; start ; start = (end?end+1:(char *)NULL)) {
/*
* Pinpoint the end of this section of the filename.
*/
continue;
pstrcpy(name2,dname);
- if (!name_map_mangle(name2,False,SNUM(conn))) continue;
+ if (!name_map_mangle(name2,False,True,SNUM(conn)))
+ continue;
if ((mangled && mangled_equal(name,name2))
|| fname_equal(name, name2))