~ubuntu-branches/ubuntu/hardy/fuse/hardy-security

« back to all changes in this revision

Viewing changes to example/hello.c

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson
  • Date: 2007-08-04 08:09:00 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20070804080900-m1e9xpk5eitzmelg
Tags: 2.7.0-1ubuntu1
* Resynchronise with Debian (LP: #128292). Remaining changes:
  - Don't install the init script; install the udev rule and the module
    configuration file instead.
  - debian/45-fuse.rules: set /dev/fuse group to fuse.
  - debian/fuse-utils.modprobe: module configuration file that mounts the
    control filesystem when fuse is loaded and unmounts it when fuse is
    unloaded, along with checking that the control FS is mounting before
    unmounting it.
  - debian/fuse-utils.install: add the udev rule, the module configuration
    file, and ulockmgr_server.
  - Load fuse on install, and set it so it gets loaded on reboot.
  - Move fusermount and ulockmgr_server to /bin and associated libraries
    to /lib.
* Use dpkg-query to fetch conffile md5sums rather than parsing
  /var/lib/dpkg/status directly.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
    FUSE: Filesystem in Userspace
3
 
    Copyright (C) 2001-2006  Miklos Szeredi <miklos@szeredi.hu>
 
3
    Copyright (C) 2001-2007  Miklos Szeredi <miklos@szeredi.hu>
4
4
 
5
5
    This program can be distributed under the terms of the GNU GPL.
6
6
    See the file COPYING.
24
24
    int res = 0;
25
25
 
26
26
    memset(stbuf, 0, sizeof(struct stat));
27
 
    if(strcmp(path, "/") == 0) {
 
27
    if (strcmp(path, "/") == 0) {
28
28
        stbuf->st_mode = S_IFDIR | 0755;
29
29
        stbuf->st_nlink = 2;
30
 
    }
31
 
    else if(strcmp(path, hello_path) == 0) {
 
30
    } else if (strcmp(path, hello_path) == 0) {
32
31
        stbuf->st_mode = S_IFREG | 0444;
33
32
        stbuf->st_nlink = 1;
34
33
        stbuf->st_size = strlen(hello_str);
35
 
    }
36
 
    else
 
34
    } else
37
35
        res = -ENOENT;
38
36
 
39
37
    return res;
45
43
    (void) offset;
46
44
    (void) fi;
47
45
 
48
 
    if(strcmp(path, "/") != 0)
 
46
    if (strcmp(path, "/") != 0)
49
47
        return -ENOENT;
50
48
 
51
49
    filler(buf, ".", NULL, 0);
57
55
 
58
56
static int hello_open(const char *path, struct fuse_file_info *fi)
59
57
{
60
 
    if(strcmp(path, hello_path) != 0)
 
58
    if (strcmp(path, hello_path) != 0)
61
59
        return -ENOENT;
62
60
 
63
 
    if((fi->flags & 3) != O_RDONLY)
 
61
    if ((fi->flags & 3) != O_RDONLY)
64
62
        return -EACCES;
65
63
 
66
64
    return 0;