~ubuntu-branches/ubuntu/feisty/devmapper/feisty

« back to all changes in this revision

Viewing changes to lib/libdm-file.c

  • Committer: Bazaar Package Importer
  • Author(s): Michael Vogt
  • Date: 2006-06-30 10:28:27 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20060630102827-tlbyu1wpfg15yrw6
Tags: 2:1.02.07-1ubuntu1
Merge from debian unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
static int _create_dir_recursive(const char *dir)
24
24
{
25
25
        char *orig, *s;
26
 
        int rc;
 
26
        int rc, r = 0;
27
27
 
28
28
        log_verbose("Creating directory \"%s\"", dir);
29
29
        /* Create parent directories */
35
35
                        if (rc < 0 && errno != EEXIST) {
36
36
                                log_error("%s: mkdir failed: %s", orig,
37
37
                                          strerror(errno));
38
 
                                dm_free(orig);
39
 
                                return 0;
 
38
                                goto out;
40
39
                        }
41
40
                }
42
41
                *s++ = '/';
43
42
        }
44
 
        dm_free(orig);
45
43
 
46
44
        /* Create final directory */
47
45
        rc = mkdir(dir, 0777);
48
46
        if (rc < 0 && errno != EEXIST) {
49
47
                log_error("%s: mkdir failed: %s", orig,
50
48
                          strerror(errno));
51
 
                return 0;
 
49
                goto out;
52
50
        }
53
 
        return 1;
 
51
 
 
52
        r = 1;
 
53
out:
 
54
        dm_free(orig);
 
55
        return r;
54
56
}
55
57
 
56
58
int create_dir(const char *dir)