Commit 67b2f9a9 authored by Matthias Clasen's avatar Matthias Clasen
Browse files

Bug 530196 – _g_local_file_has_trash_dir() doesn't handle st_dev == 0

        * glocalfile.c (_g_local_file_has_trash_dir): Handle the case that
        st_dev might be zero.



svn path=/trunk/; revision=6901
parent 537075e9
2008-05-17 Matthias Clasen <mclasen@redhat.com>
Bug 530196 – _g_local_file_has_trash_dir() doesn't handle st_dev == 0
* glocalfile.c (_g_local_file_has_trash_dir): Handle the case that
st_dev might be zero.
2008-05-16 Tor Lillqvist <tml@novell.com>
* win32/gwin32directorymonitor.c: #define _WIN32_WINNT 0x0400 to
......
......@@ -1580,7 +1580,8 @@ escape_trash_name (char *name)
gboolean
_g_local_file_has_trash_dir (const char *dirname, dev_t dir_dev)
{
static gsize home_dev = 0;
static gsize home_dev_set = 0;
static dev_t home_dev;
char *topdir, *globaldir, *trashdir, *tmpname;
uid_t uid;
char uid_str[32];
......@@ -1588,18 +1589,17 @@ _g_local_file_has_trash_dir (const char *dirname, dev_t dir_dev)
gboolean res;
int statres;
if (g_once_init_enter (&home_dev))
if (g_once_init_enter (&home_dev_set))
{
gsize setup_value = 0;
struct stat home_stat;
g_stat (g_get_home_dir (), &home_stat);
setup_value = home_stat.st_dev;
g_once_init_leave (&home_dev, setup_value);
home_dev = home_stat.st_dev;
g_once_init_leave (&home_dev_set, 1);
}
/* Assume we can trash to the home */
if (dir_dev == (dev_t)home_dev)
if (dir_dev == home_dev)
return TRUE;
topdir = find_mountpoint_for (dirname, dir_dev);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment