0

I have a directory mounted by fuse,and i am intented to use lstat() against this dirctory.But,when i run the following code,it just wait there and prompt nothing. And by the way,i run the fuse in the android emulator. the code is:

#include <sys/stat.h>
#include <stdio.h>

void main(){
    printf("new test!!!");
    char *path="/data/pwrite/test_12/";
    struct stat *stbuf;
    int res=12;
    res=lstat(path, stbuf);
    printf("%d",res);
}

And,"/data/pwrite/test_12/" is the fuse-mounted directory.What's more,when i try another dicrtory that share the same parent directory but not mounted by fuse,like /data/pwrite/test_13/,it works! so,i definely sure it is leaded by fuse.But,i'm even more confused that whether it is due to the conflict between fuse and android. Any idea?thx

kaiwii ho
  • 1,367
  • 7
  • 21
  • 40

2 Answers2

0

Try without the bugs and see if that works better.

#include <sys/stat.h>
#include <stdio.h>

void main(){
    printf("new test!!!\n");
    const char *path="/data/pwrite/test_13/";
    struct stat stbuf; 
    int res=12;
    res=lstat(path, &stbuf);
    printf("%d\n",res);
}
David Schwartz
  • 179,497
  • 17
  • 214
  • 278
  • the real promble is not the code itself.When i switch to another folder not mounted by fuse,everything comes to be ok! – kaiwii ho May 31 '12 at 06:32
  • There's no way you can tell what the problem is if you test with code with massive bugs and undefined behavior in it. For example, your code passes the value of `stbuf` to `lstat` even though it never initializes `stbuf` to anything in particular. – David Schwartz May 31 '12 at 08:22
  • yes,u r right.c is quiet different from java.but the problem still exist,if i use ur code to test.Any more idea?thx – kaiwii ho Jun 01 '12 at 01:50
  • What exactly are you trying to do? – David Schwartz Jun 01 '12 at 02:51
  • i need to specify my filesystem in android via fuse.And,within it,i need to wrap the generic systemcall,like lsstat to realize my own.But,if it went wrong with the generic systemcall,it seems to no way to go further. – kaiwii ho Jun 01 '12 at 03:04
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/12009/discussion-between-david-schwartz-and-kaiwii-ho) – David Schwartz Jun 01 '12 at 03:42
0

why it not work?because there runs several fuse-deamon currently.

kaiwii ho
  • 1,367
  • 7
  • 21
  • 40