$NetBSD: patch-aa,v 1.2 2016/03/01 20:16:17 joerg Exp $ --- src/loggedfs.cpp.orig 2007-01-23 21:05:11.000000000 +0000 +++ src/loggedfs.cpp @@ -30,7 +30,11 @@ #include #include #include +#ifdef HAVE_SYS_STATVFS_H +#include +#else #include +#endif #ifdef HAVE_SETXATTR #include #endif @@ -85,12 +89,14 @@ static bool isAbsolutePath( const char * static char* getAbsolutePath(const char *path) { - char *realPath=new char[strlen(path)+strlen(loggedfsArgs->mountPoint)+1]; + char *realPath=new char[strlen(path)+strlen(loggedfsArgs->mountPoint)+2]; + + (void) snprintf(realPath, strlen(path)+strlen(loggedfsArgs->mountPoint)+2, + "%s%s%s", + loggedfsArgs->mountPoint, + (path[0] == '/') ? "" : "/", + path); - strcpy(realPath,loggedfsArgs->mountPoint); - if (realPath[strlen(realPath)-1]=='/') - realPath[strlen(realPath)-1]='\0'; - strcat(realPath,path); return realPath; } @@ -121,7 +127,7 @@ static char* getcallername() static void loggedfs_log(const char* path,const char* action,const int returncode,const char *format,...) { - char *retname; + const char *retname; if (returncode >= 0) retname = "SUCCESS"; else @@ -156,7 +162,7 @@ static int loggedFS_getattr(const char * char *aPath=getAbsolutePath(path); path=getRelativePath(path); - res = lstat(path, stbuf); + res = lstat(aPath, stbuf); loggedfs_log(aPath,"getattr",res,"getattr %s",aPath); if(res == -1) return -errno; @@ -210,7 +216,7 @@ static int loggedFS_readdir(const char * path=getRelativePath(path); - dp = opendir(path); + dp = opendir(aPath); if(dp == NULL) { res = -errno; loggedfs_log(aPath,"readdir",-1,"readdir %s",aPath); @@ -427,7 +433,7 @@ static int loggedFS_truncate(const char return 0; } -#if (FUSE_USE_VERSION==25) +#if (FUSE_USE_VERSION >= 25) static int loggedFS_utime(const char *path, struct utimbuf *buf) { int res; @@ -650,7 +656,11 @@ bool processArgs(int argc, char *argv[], // logging the ~/.kde/share/config directory, in which hard links for lock // files are verified by their inode equivalency. +#ifdef __NetBSD__ +#define COMMON_OPTS "" +#else #define COMMON_OPTS "nonempty,use_ino" +#endif while ((res = getopt (argc, argv, "hpfec:l:")) != -1) { @@ -770,7 +780,7 @@ int main(int argc, char *argv[]) loggedFS_oper.chmod = loggedFS_chmod; loggedFS_oper.chown = loggedFS_chown; loggedFS_oper.truncate = loggedFS_truncate; -#if (FUSE_USE_VERSION==25) +#if (FUSE_USE_VERSION >= 25) loggedFS_oper.utime = loggedFS_utime; #else loggedFS_oper.utimens = loggedFS_utimens;