~ubuntu-branches/ubuntu/maverick/evolution-data-server/maverick-proposed

« back to all changes in this revision

Viewing changes to libdb/os/os_unlink.c

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2010-05-17 17:02:06 UTC
  • mfrom: (1.1.79 upstream) (1.6.12 experimental)
  • Revision ID: james.westby@ubuntu.com-20100517170206-4ufr52vwrhh26yh0
Tags: 2.30.1-1ubuntu1
* Merge from debian experimental. Remaining change:
  (LP: #42199, #229669, #173703, #360344, #508494)
  + debian/control:
    - add Vcs-Bzr tag
    - don't use libgnome
    - Use Breaks instead of Conflicts against evolution 2.25 and earlier.
  + debian/evolution-data-server.install,
    debian/patches/45_libcamel_providers_version.patch:
    - use the upstream versioning, not a Debian-specific one 
  + debian/libedata-book1.2-dev.install, debian/libebackend-1.2-dev.install,
    debian/libcamel1.2-dev.install, debian/libedataserverui1.2-dev.install:
    - install html documentation
  + debian/rules:
    - don't build documentation it's shipped with the tarball

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*-
2
 
 * See the file LICENSE for redistribution information.
3
 
 *
4
 
 * Copyright (c) 1997-2002
5
 
 *      Sleepycat Software.  All rights reserved.
6
 
 */
7
 
 
8
 
#include "db_config.h"
9
 
 
10
 
#ifndef lint
11
 
static const char revid[] = "$Id$";
12
 
#endif /* not lint */
13
 
 
14
 
#ifndef NO_SYSTEM_INCLUDES
15
 
#include <sys/types.h>
16
 
 
17
 
#include <string.h>
18
 
#include <unistd.h>
19
 
#endif
20
 
 
21
 
#include "db_int.h"
22
 
 
23
 
/*
24
 
 * __os_region_unlink --
25
 
 *      Remove a shared memory object file.
26
 
 *
27
 
 * PUBLIC: int __os_region_unlink __P((DB_ENV *, const char *));
28
 
 */
29
 
int
30
 
__os_region_unlink(dbenv, path)
31
 
        DB_ENV *dbenv;
32
 
        const char *path;
33
 
{
34
 
#ifdef HAVE_QNX
35
 
        int ret;
36
 
        char *newname;
37
 
 
38
 
        if ((ret = __os_shmname(dbenv, path, &newname)) != 0)
39
 
                goto err;
40
 
 
41
 
        if ((ret = shm_unlink(newname)) != 0) {
42
 
                ret = __os_get_errno();
43
 
                if (ret != ENOENT)
44
 
                        __db_err(dbenv, "shm_unlink: %s: %s",
45
 
                            newname, strerror(ret));
46
 
        }
47
 
err:
48
 
        if (newname != NULL)
49
 
                __os_free(dbenv, newname);
50
 
        return (ret);
51
 
#else
52
 
        if (F_ISSET(dbenv, DB_ENV_OVERWRITE))
53
 
                (void)__db_overwrite(dbenv, path);
54
 
 
55
 
        return (__os_unlink(dbenv, path));
56
 
#endif
57
 
}
58
 
 
59
 
/*
60
 
 * __os_unlink --
61
 
 *      Remove a file.
62
 
 *
63
 
 * PUBLIC: int __os_unlink __P((DB_ENV *, const char *));
64
 
 */
65
 
int
66
 
__os_unlink(dbenv, path)
67
 
        DB_ENV *dbenv;
68
 
        const char *path;
69
 
{
70
 
        int ret;
71
 
 
72
 
retry:  ret = DB_GLOBAL(j_unlink) != NULL ?
73
 
            DB_GLOBAL(j_unlink)(path) :
74
 
#ifdef HAVE_VXWORKS
75
 
            unlink((char *)path);
76
 
#else
77
 
            unlink(path);
78
 
#endif
79
 
        if (ret == -1) {
80
 
                if ((ret = __os_get_errno()) == EINTR)
81
 
                        goto retry;
82
 
                /*
83
 
                 * XXX
84
 
                 * We really shouldn't be looking at this value ourselves,
85
 
                 * but ENOENT usually signals that a file is missing, and
86
 
                 * we attempt to unlink things (such as v. 2.x environment
87
 
                 * regions, in DB_ENV->remove) that we're expecting not to
88
 
                 * be there.  Reporting errors in these cases is annoying.
89
 
                 */
90
 
#ifdef HAVE_VXWORKS
91
 
                /*
92
 
                 * XXX
93
 
                 * The results of unlink are file system driver specific
94
 
                 * on VxWorks.  In the case of removing a file that did
95
 
                 * not exist, some, at least, return an error, but with
96
 
                 * an errno of 0, not ENOENT.
97
 
                 *
98
 
                 * Code below falls through to original if-statement only
99
 
                 * we didn't get a "successful" error.
100
 
                 */
101
 
                if (ret != 0)
102
 
                /* FALLTHROUGH */
103
 
#endif
104
 
                if (ret != ENOENT)
105
 
                        __db_err(dbenv, "unlink: %s: %s", path, strerror(ret));
106
 
        }
107
 
 
108
 
        return (ret);
109
 
}