[vhffs-dev] [666] add a workaround for df ...

[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]


Revision: 666
Author:   gradator
Date:     2007-07-05 17:20:07 +0000 (Thu, 05 Jul 2007)

Log Message:
-----------
add a workaround for df ...

Modified Paths:
--------------
    trunk/vhffs-tools/src/vhffsfs.c


Modified: trunk/vhffs-tools/src/vhffsfs.c
===================================================================
--- trunk/vhffs-tools/src/vhffsfs.c	2007-07-05 15:32:23 UTC (rev 665)
+++ trunk/vhffs-tools/src/vhffsfs.c	2007-07-05 17:20:07 UTC (rev 666)
@@ -9,6 +9,7 @@
 #define WITH_CACHE 1
 #define VHFFSFS_MAXCONNDB 5
 #define VHFFSFS_CONFIG "/etc/vhffsfs.conf"
+#define VHFFSFS_EMPTYDIR "/tmp/emptydir"
 
 #define _GNU_SOURCE
 
@@ -565,7 +566,7 @@
 	if(*(path+0) == '.') return strdup(path);
 	// fetch homedir
 	homedir = vhffsfs_gethomedir();
-	if(!homedir) return NULL;
+	if(!homedir) return strdup(VHFFSFS_EMPTYDIR);
 	// -- parse path
 	// /                   | home directory ----------------------------|
 	// /first              | home file | group directory ---------------|
@@ -1329,7 +1330,20 @@
 
 int main(int argc, char *argv[])
 {
-	int i;
+	int i, res;
+	struct stat st;
+
+	// create empty directory
+	stat(VHFFSFS_EMPTYDIR, &st);
+	if(!S_ISDIR(st.st_mode))  {
+		res = mkdir(VHFFSFS_EMPTYDIR, 0700);
+		if(res)  {
+			printf("Unable to create empty directory: '%s': %s\n", VHFFSFS_EMPTYDIR, strerror(errno));
+			exit(1);
+		}
+	}
+
+	// init vhffsfs struct
 	for(i = 0 ; i < VHFFSFS_MAXCONNDB ; i++)   {
 		vhffsfs.pg_conn[i] = NULL;
 		pthread_mutex_init(&vhffsfs.pg_lock[i], NULL);


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/