Displaying 1 result from an estimated 1 matches for "fn_max".
Did you mean:
pfn_max
2002 Jun 07
0
problem related to filename length
...eiver.c Sat Jun 8 03:41:22 2002
@@ -163,10 +163,16 @@
}
}
+#include <sys/vfs.h>
+static inline int fname_syslimit(const char* path) {
+ struct statfs sb;
+ return !statfs(path,&sb) ? sb.f_namelen : 255;
+}
static int get_tmpname(char *fnametmp, char *fname)
{
char *f;
+ int fn_max;
/* open tmp file */
if (tmpdir) {
@@ -179,7 +185,12 @@
rprintf(FERROR,"filename too long\n");
return 0;
}
- snprintf(fnametmp,MAXPATHLEN, "%s/.%s.XXXXXX",tmpdir,f);
+ fn_max = fname_syslimit(tmpdir);
+ if(strlen(f)+9 > fn_max) {
+ snprintf(fnametmp,MAX...