mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 11:26:16 +01:00
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
This commit is contained in:
parent
537075e94c
commit
67b2f9a99b
@ -1,3 +1,10 @@
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user