- sprintf( buf, "%08x\n", 0 );
- write( fd, buf, strlen(buf) );
-
- sprintf( buf, "%s\n%s\n%s\n%ld\n%s\n", source, target, filesystemtype,
- mountflags, data );
- write( fd, buf, strlen(buf) );
-
- char inbuf[10];
- int n = read( fd, inbuf, 9 );
- inbuf[n] = '\0';
-
- int r;
- assert( sscanf( inbuf, "%08x\n", &r ) == 1);
-
- int fuse_fd = 0;
- if( r < 0 ) {
- errno = r;
- return -1;
- } else if( r > 0 ) {
- // get the fd
- fuse_fd = receive_fd(fd);
-
- // what was the old fd?
- int old_fd;
- char extra[1024];
- int s = sscanf( data, "fd=%d,%s", &old_fd, extra );
- assert( dup2( fuse_fd, old_fd ) == old_fd );