Commit 2be57792 authored by Brian Cameron's avatar Brian Cameron Committed by Brian Cameron

Now use g_ stdio function like g_chmod instead of chmod. Fixes bug

2005-12-22  Brian Cameron  <brian.cameron@sun.com>

        * daemon/auth.c, daemon/display.c, daemon/errorgui.c,
          daemon/filecheck.c, daemon/fstype.c, daemon/gdm-net.c,
          daemon/gdm.[ch], daemon/gdmconfig.c, daemon/misc.c,
          daemon/server.c, daemon/slave.c, daemon/verify-pam.c,
          daemon/xdmcp.c, gui/gdmXnestchooser.c, gui/gdmchooser.c,
          gui/gdmcommon.c, gui/gdmlogin.c, gui/gdmphotosetup.c,
          gui/gdmsetup.c, gui/gdmuser.c, utils/gdmprefetch.c,
          vicious-extensions/ve-config.c, vicious-extensions/ve-gnome.c,
          vicious-extensions/ve-misc.[ch], vicious-extensions/ve-nongnome.c:
          Now use g_ stdio function like g_chmod instead of chmod.
          Fixes bug #310229.
parent c9bf94f2
2005-12-22 Brian Cameron <brian.cameron@sun.com>
* daemon/auth.c, daemon/display.c, daemon/errorgui.c,
daemon/filecheck.c, daemon/fstype.c, daemon/gdm-net.c,
daemon/gdm.[ch], daemon/gdmconfig.c, daemon/misc.c,
daemon/server.c, daemon/slave.c, daemon/verify-pam.c,
daemon/xdmcp.c, gui/gdmXnestchooser.c, gui/gdmchooser.c,
gui/gdmcommon.c, gui/gdmlogin.c, gui/gdmphotosetup.c,
gui/gdmsetup.c, gui/gdmuser.c, utils/gdmprefetch.c,
vicious-extensions/ve-config.c, vicious-extensions/ve-gnome.c,
vicious-extensions/ve-misc.[ch], vicious-extensions/ve-nongnome.c:
Now use g_ stdio function like g_chmod instead of chmod.
Fixes bug #310229.
2005-12-21 Brian Cameron <brian.cameron@sun.com>
* daemon/gdm.[ch], daemon/gdmconfig.c, daemon/server.c: Add new
......
......@@ -616,7 +616,7 @@ try_user_add_again:
d->userauth = g_build_filename (authdir, userauthfile, NULL);
user_auth_exists = (d->userauth != NULL &&
access (d->userauth, F_OK) == 0);
g_access (d->userauth, F_OK) == 0);
/* Find out if the Xauthority file passes the paranoia check */
/* Note that this is not very efficient, we stat the files over
......@@ -648,7 +648,7 @@ try_user_add_again:
was of wrong permissions, but more likely this is
file on NFS dir with root-squashing enabled) */
if ( ! user_auth_exists && d->userauth != NULL)
unlink (d->userauth);
g_unlink (d->userauth);
/* No go. Let's create a fallback file in GDM_KEY_USER_AUTHDIR_FALLBACK (/tmp)
* or perhaps userauthfile directory (usually would be /tmp) */
......@@ -814,14 +814,14 @@ gdm_auth_user_remove (GdmDisplay *d, uid_t user)
/* If we are using the fallback cookie location, simply nuke the
* cookie file */
if (d->authfb) {
VE_IGNORE_EINTR (unlink (d->userauth));
VE_IGNORE_EINTR (g_unlink (d->userauth));
g_free (d->userauth);
d->userauth = NULL;
return;
}
/* if the file doesn't exist, oh well, just ignore this then */
if G_UNLIKELY (access (d->userauth, F_OK) != 0) {
if G_UNLIKELY (g_access (d->userauth, F_OK) != 0) {
g_free (d->userauth);
d->userauth = NULL;
return;
......@@ -990,7 +990,7 @@ gdm_auth_purge (GdmDisplay *d, FILE *af, gboolean remove_when_empty)
if (remove_when_empty &&
keep == NULL) {
VE_IGNORE_EINTR (unlink (d->userauth));
VE_IGNORE_EINTR (g_unlink (d->userauth));
return NULL;
}
......
......@@ -482,14 +482,14 @@ gdm_display_dispose (GdmDisplay *d)
if (d->type == TYPE_XDMCP_PROXY) {
if (d->parent_auth_file != NULL) {
VE_IGNORE_EINTR (unlink (d->parent_auth_file));
VE_IGNORE_EINTR (g_unlink (d->parent_auth_file));
}
g_free (d->parent_auth_file);
d->parent_auth_file = NULL;
}
if (d->parent_temp_auth_file != NULL) {
VE_IGNORE_EINTR (unlink (d->parent_temp_auth_file));
VE_IGNORE_EINTR (g_unlink (d->parent_temp_auth_file));
}
g_free (d->parent_temp_auth_file);
d->parent_temp_auth_file = NULL;
......
......@@ -257,7 +257,7 @@ setup_dialog (GdmDisplay *d, const char *name, int closefdexcept, gboolean set_g
gchar *gtkrc = gdm_get_value_string (GDM_KEY_GTKRC);
if ( ! ve_string_empty (gtkrc) &&
access (gtkrc, R_OK) == 0)
g_access (gtkrc, R_OK) == 0)
gtk_rc_parse (gtkrc);
theme_name = d->theme_name;
......@@ -269,7 +269,7 @@ setup_dialog (GdmDisplay *d, const char *name, int closefdexcept, gboolean set_g
g_free (theme_dir);
if ( ! ve_string_empty (theme) &&
access (theme, R_OK) == 0)
g_access (theme, R_OK) == 0)
gtk_rc_parse (theme);
g_free (theme);
......@@ -338,7 +338,7 @@ gdm_error_box_full (GdmDisplay *d, GtkMessageType type, const char *error,
GString *gs = g_string_new (NULL);
fp = NULL;
VE_IGNORE_EINTR (r = lstat (details_file, &s));
VE_IGNORE_EINTR (r = g_lstat (details_file, &s));
if (r == 0) {
if (S_ISREG (s.st_mode)) {
VE_IGNORE_EINTR (fp = fopen (details_file, "r"));
......
......@@ -54,7 +54,7 @@ gdm_file_check (const gchar *caller, uid_t user, const gchar *dir,
return FALSE;
/* Stat directory */
VE_IGNORE_EINTR (r = stat (dir, &statbuf));
VE_IGNORE_EINTR (r = g_stat (dir, &statbuf));
if (r < 0) {
if ( ! absentdirok)
syslog (LOG_WARNING, _("%s: Directory %s does not exist."),
......@@ -88,7 +88,7 @@ gdm_file_check (const gchar *caller, uid_t user, const gchar *dir,
fullpath = g_build_filename (dir, file, NULL);
/* Stat file */
VE_IGNORE_EINTR (r = stat (fullpath, &statbuf));
VE_IGNORE_EINTR (r = g_stat (fullpath, &statbuf));
if (r < 0) {
/* Return true if file does not exist and that is ok */
if (absentok) {
......@@ -156,7 +156,7 @@ gdm_auth_file_check (const gchar *caller, uid_t user, const gchar *authfile, gbo
return FALSE;
/* Stat file */
VE_IGNORE_EINTR (r = lstat (authfile, &statbuf));
VE_IGNORE_EINTR (r = g_lstat (authfile, &statbuf));
if (s != NULL)
*s = statbuf;
if (r < 0) {
......
......@@ -295,7 +295,7 @@ filesystem_type_uncached (char *path, char *relpath, struct stat *statp)
else
#endif /* not hpux */
{
if (stat (mnt->mnt_dir, &disk_stats) == -1) {
if (g_stat (mnt->mnt_dir, &disk_stats) == -1) {
if (errno == EACCES)
continue;
else
......
......@@ -274,7 +274,7 @@ gdm_connection_open_unix (const char *sockname, mode_t mode)
try_again:
/* this is all for creating sockets in /tmp/ safely */
VE_IGNORE_EINTR (unlink (sockname));
VE_IGNORE_EINTR (g_unlink (sockname));
if G_UNLIKELY (errno == EISDIR ||
errno == EPERM) {
/* likely a directory, someone's playing tricks on us */
......@@ -284,8 +284,8 @@ try_again:
newname = g_strdup_printf ("%s-renamed-%u",
sockname,
(guint)g_random_int ());
} while (access (newname, F_OK) == 0);
VE_IGNORE_EINTR (rename (sockname, newname));
} while (g_access (newname, F_OK) == 0);
VE_IGNORE_EINTR (g_rename (sockname, newname));
if G_UNLIKELY (errno != 0)
try_again_attempts = 0;
g_free (newname);
......@@ -308,7 +308,7 @@ try_again:
return NULL;
}
VE_IGNORE_EINTR (chmod (sockname, mode));
VE_IGNORE_EINTR (g_chmod (sockname, mode));
conn = g_new0 (GdmConnection, 1);
conn->disp = NULL;
......@@ -381,7 +381,7 @@ gdm_connection_open_fifo (const char *fifo, mode_t mode)
GdmConnection *conn;
int fd;
VE_IGNORE_EINTR (unlink (fifo));
VE_IGNORE_EINTR (g_unlink (fifo));
if G_UNLIKELY (mkfifo (fifo, 0660) < 0) {
gdm_error (_("%s: Could not make FIFO"),
......@@ -397,7 +397,7 @@ gdm_connection_open_fifo (const char *fifo, mode_t mode)
return NULL;
}
VE_IGNORE_EINTR (chmod (fifo, mode));
VE_IGNORE_EINTR (g_chmod (fifo, mode));
conn = g_new0 (GdmConnection, 1);
conn->disp = NULL;
......
......@@ -221,7 +221,7 @@ gdm_daemonify (void)
gdm_fail (_("%s: setsid () failed: %s!"), "gdm_daemonify",
strerror (errno));
VE_IGNORE_EINTR (chdir (gdm_get_value_string (GDM_KEY_SERV_AUTHDIR)));
VE_IGNORE_EINTR (g_chdir (gdm_get_value_string (GDM_KEY_SERV_AUTHDIR)));
umask (022);
VE_IGNORE_EINTR (close (0));
......@@ -363,7 +363,7 @@ gdm_final_cleanup (void)
char *path;
gdm_connection_close (fifoconn);
path = g_build_filename (gdm_get_value_string (GDM_KEY_SERV_AUTHDIR), ".gdmfifo", NULL);
VE_IGNORE_EINTR (unlink (path));
VE_IGNORE_EINTR (g_unlink (path));
g_free (path);
fifoconn = NULL;
}
......@@ -380,7 +380,7 @@ gdm_final_cleanup (void)
if (unixconn != NULL) {
gdm_connection_close (unixconn);
VE_IGNORE_EINTR (unlink (GDM_SUP_SOCKET));
VE_IGNORE_EINTR (g_unlink (GDM_SUP_SOCKET));
unixconn = NULL;
}
......@@ -388,7 +388,7 @@ gdm_final_cleanup (void)
pidfile = gdm_get_value_string (GDM_KEY_PID_FILE);
if (pidfile != NULL) {
VE_IGNORE_EINTR (unlink (pidfile));
VE_IGNORE_EINTR (g_unlink (pidfile));
}
#ifdef HAVE_LOGINDEVPERM
......@@ -408,7 +408,7 @@ deal_with_x_crashes (GdmDisplay *d)
char *bin = ve_first_word (failsafe);
/* Yay we have a failsafe */
if ( ! ve_string_empty (bin) &&
access (bin, X_OK) == 0) {
g_access (bin, X_OK) == 0) {
gdm_info (_("%s: Trying failsafe X "
"server %s"),
"deal_with_x_crashes",
......@@ -424,7 +424,7 @@ deal_with_x_crashes (GdmDisplay *d)
/* Eeek X keeps crashing, let's try the XKeepsCrashing script */
if ( ! ve_string_empty (keepscrashing) &&
access (keepscrashing, X_OK|R_OK) == 0) {
g_access (keepscrashing, X_OK|R_OK) == 0) {
pid_t pid;
gdm_info (_("%s: Running the "
......@@ -539,7 +539,7 @@ deal_with_x_crashes (GdmDisplay *d)
/* if we have "open" we can talk to the user, not as user
* friendly as the above script, but getting there */
if ( ! just_abort &&
access (EXPANDED_LIBEXECDIR "/gdmopen", X_OK) == 0) {
g_access (EXPANDED_LIBEXECDIR "/gdmopen", X_OK) == 0) {
/* Shit if we knew what the program was to tell the user,
* the above script would have been defined and we'd run
* it for them */
......@@ -584,7 +584,7 @@ suspend_machine (void)
/* Also make a new process group */
setsid ();
VE_IGNORE_EINTR (chdir ("/"));
VE_IGNORE_EINTR (g_chdir ("/"));
/* short sleep to give some processing time to master */
usleep (1000);
......@@ -612,7 +612,7 @@ change_to_first_and_clear (gboolean reboot)
g_setenv ("TERM", "linux", TRUE);
/* evil hack that will get the fonts right */
if (access ("/bin/bash", X_OK) == 0)
if (g_access ("/bin/bash", X_OK) == 0)
system ("/bin/bash -l -c /bin/true");
/* clear screen and set to red */
......@@ -635,7 +635,7 @@ halt_machine (void)
gdm_info (_("Master halting..."));
gdm_final_cleanup ();
VE_IGNORE_EINTR (chdir ("/"));
VE_IGNORE_EINTR (g_chdir ("/"));
#ifdef __linux__
change_to_first_and_clear (FALSE /* reboot */);
......@@ -657,7 +657,7 @@ reboot_machine (void)
gdm_info (_("Master rebooting..."));
gdm_final_cleanup ();
VE_IGNORE_EINTR (chdir ("/"));
VE_IGNORE_EINTR (g_chdir ("/"));
#ifdef __linux__
change_to_first_and_clear (TRUE /* reboot */);
......@@ -1298,7 +1298,7 @@ gdm_get_our_runlevel (void)
#ifdef __linux__
/* on linux we get our current runlevel, for use later
* to detect a shutdown going on, and not mess up. */
if (access ("/sbin/runlevel", X_OK) == 0) {
if (g_access ("/sbin/runlevel", X_OK) == 0) {
char ign;
int rnl;
FILE *fp = popen ("/sbin/runlevel", "r");
......@@ -1341,7 +1341,7 @@ gdm_make_global_cookie (void)
gdm_global_bcookie = (unsigned char *) faked.bcookie;
file = g_build_filename (gdm_get_value_string (GDM_KEY_SERV_AUTHDIR), ".cookie", NULL);
VE_IGNORE_EINTR (unlink (file));
VE_IGNORE_EINTR (g_unlink (file));
oldmode = umask (077);
fp = gdm_safe_fopen_w (file);
......@@ -1459,7 +1459,7 @@ main (int argc, char *argv[])
pidfile = gdm_get_value_string (GDM_KEY_PID_FILE);
/* Check if another gdm process is already running */
if (access (pidfile, R_OK) == 0) {
if (g_access (pidfile, R_OK) == 0) {
/* Check if the existing process is still alive. */
gint pidv;
......@@ -1507,15 +1507,15 @@ main (int argc, char *argv[])
}
VE_IGNORE_EINTR (chdir (gdm_get_value_string (GDM_KEY_SERV_AUTHDIR)));
VE_IGNORE_EINTR (g_chdir (gdm_get_value_string (GDM_KEY_SERV_AUTHDIR)));
umask (022);
}
else
gdm_daemonify ();
#ifdef sun
unlink (SDTLOGIN_DIR);
mkdir (SDTLOGIN_DIR, 0700);
g_unlink (SDTLOGIN_DIR);
g_mkdir (SDTLOGIN_DIR, 0700);
#endif
/* Signal handling */
......@@ -2623,7 +2623,7 @@ handle_flexi_server (GdmConnection *conn, int type, const char *server,
bin = ve_first_word (server);
if (ve_string_empty (server) ||
access (bin, X_OK) != 0) {
g_access (bin, X_OK) != 0) {
g_free (bin);
if (conn != NULL)
gdm_connection_write (conn,
......@@ -3054,9 +3054,6 @@ gdm_handle_user_message (GdmConnection *conn, const char *msg, gpointer data)
else if (g_strcasecmp (splitstr[1], "CHOOSER") == 0 &&
!svr->chooser)
gdm_connection_printf (conn, "OK false\n");
else if (g_strcasecmp (splitstr[1], "PRIORITY") == 0 &&
!svr->chooser)
gdm_connection_printf (conn, "OK false\n");
else
gdm_connection_printf (conn, "ERROR 2 Key not valid\n");
......
......@@ -20,6 +20,7 @@
#define GDM_H
#include <glib.h>
#include <glib/gstdio.h>
#include <X11/Xlib.h>
#include <X11/Xmd.h>
#include <X11/Xauth.h>
......
......@@ -537,14 +537,14 @@ gdm_get_config (struct stat *statbuf)
/* Not NULL if config_file was set by command-line option. */
if (config_file != NULL) {
VE_IGNORE_EINTR (r = stat (config_file, statbuf));
VE_IGNORE_EINTR (r = g_stat (config_file, statbuf));
if (r < 0) {
gdm_error (_("%s: No GDM configuration file: %s. Using defaults."),
"gdm_config_parse", config_file);
return NULL;
}
} else {
VE_IGNORE_EINTR (r = stat (GDM_SYSCONFDIR_CONFIG_FILE, statbuf));
VE_IGNORE_EINTR (r = g_stat (GDM_SYSCONFDIR_CONFIG_FILE, statbuf));
if (r < 0) {
gdm_error (_("%s: No GDM configuration file: %s. Using defaults."),
"gdm_config_parse", GDM_SYSCONFDIR_CONFIG_FILE);
......@@ -570,7 +570,7 @@ gdm_get_custom_config (struct stat *statbuf)
gchar *file = g_strdup_printf ("%s-custom", GDM_SYSCONFDIR_CONFIG_FILE);
int r;
VE_IGNORE_EINTR (r = stat (file, statbuf));
VE_IGNORE_EINTR (r = g_stat (file, statbuf));
if (r >= 0) {
custom_config_file = file;
return ve_config_new (custom_config_file);
......@@ -876,14 +876,14 @@ _gdm_set_value_string (gchar *key, gchar *value_in, gboolean doing_update)
bin = ve_first_word (value);
if G_UNLIKELY (ve_string_empty (bin) ||
access (bin, X_OK) != 0) {
g_access (bin, X_OK) != 0) {
gdm_info (_("%s: Standard X server not found; trying alternatives"),
"gdm_config_parse");
if (access ("/usr/X11R6/bin/X", X_OK) == 0) {
if (g_access ("/usr/X11R6/bin/X", X_OK) == 0) {
*setting = g_strdup ("/usr/X11R6/bin/X");
} else if (access ("/opt/X11R6/bin/X", X_OK) == 0) {
} else if (g_access ("/opt/X11R6/bin/X", X_OK) == 0) {
*setting = g_strdup ("/opt/X11R6/bin/X");
} else if (access ("/usr/bin/X11/X", X_OK) == 0) {
} else if (g_access ("/usr/bin/X11/X", X_OK) == 0) {
*setting = g_strdup ("/usr/bin/X11/X");
} else
*setting = g_strdup (value);
......@@ -1428,8 +1428,8 @@ gdm_update_config (gchar* key)
}
/* Don't bother re-reading configuration if files have not changed */
VE_IGNORE_EINTR (stat (config_file, &statbuf));
VE_IGNORE_EINTR (stat (custom_config_file, &custom_statbuf));
VE_IGNORE_EINTR (g_stat (config_file, &statbuf));
VE_IGNORE_EINTR (g_stat (custom_config_file, &custom_statbuf));
/*
* Do not reset mtime to the latest values since there is no
......@@ -1519,7 +1519,7 @@ check_logdir (void)
struct stat statbuf;
int r;
VE_IGNORE_EINTR (r = stat (GdmLogDir, &statbuf));
VE_IGNORE_EINTR (r = g_stat (GdmLogDir, &statbuf));
if (r < 0 ||
! S_ISDIR (statbuf.st_mode)) {
gdm_error (_("%s: Logdir %s does not exist or isn't a directory. Using ServAuthDir %s."), "gdm_config_parse",
......@@ -1535,7 +1535,7 @@ check_servauthdir (struct stat *statbuf)
int r;
/* Enter paranoia mode */
VE_IGNORE_EINTR (r = stat (GdmServAuthDir, statbuf));
VE_IGNORE_EINTR (r = g_stat (GdmServAuthDir, statbuf));
if G_UNLIKELY (r < 0) {
gchar *s = g_strdup_printf
(C_(N_("Server Authorization directory "
......@@ -1761,13 +1761,13 @@ gdm_config_parse (void)
}
bin = ve_first_word (GdmStandardXserver);
if G_LIKELY (access (bin, X_OK) == 0) {
if G_LIKELY (g_access (bin, X_OK) == 0) {
server = GdmStandardXserver;
} else if (access ("/usr/bin/X11/X", X_OK) == 0) {
} else if (g_access ("/usr/bin/X11/X", X_OK) == 0) {
server = "/usr/bin/X11/X";
} else if (access ("/usr/X11R6/bin/X", X_OK) == 0) {
} else if (g_access ("/usr/X11R6/bin/X", X_OK) == 0) {
server = "/usr/X11R6/bin/X";
} else if (access ("/opt/X11R6/bin/X", X_OK) == 0) {
} else if (g_access ("/opt/X11R6/bin/X", X_OK) == 0) {
server = "/opt/X11R6/bin/X";
}
g_free (bin);
......@@ -1871,13 +1871,13 @@ gdm_config_parse (void)
/* Check that the greeter can be executed */
bin = ve_first_word (GdmGreeter);
if G_UNLIKELY (ve_string_empty (bin) || access (bin, X_OK) != 0) {
if G_UNLIKELY (ve_string_empty (bin) || g_access (bin, X_OK) != 0) {
gdm_error (_("%s: Greeter not found or can't be executed by the GDM user"), "gdm_config_parse");
}
g_free (bin);
bin = ve_first_word (GdmRemoteGreeter);
if G_UNLIKELY (ve_string_empty (bin) || access (bin, X_OK) != 0) {
if G_UNLIKELY (ve_string_empty (bin) || g_access (bin, X_OK) != 0) {
gdm_error (_("%s: Remote greeter not found or can't be executed by the GDM user"), "gdm_config_parse");
}
g_free (bin);
......@@ -1885,7 +1885,7 @@ gdm_config_parse (void)
/* Check that chooser can be executed */
bin = ve_first_word (GdmChooser);
if G_UNLIKELY (GdmIndirect && (ve_string_empty (bin) || access (bin, X_OK) != 0)) {
if G_UNLIKELY (GdmIndirect && (ve_string_empty (bin) || g_access (bin, X_OK) != 0)) {
gdm_error (_("%s: Chooser not found or it can't be executed by the GDM user"), "gdm_config_parse");
}
......@@ -1912,7 +1912,7 @@ gdm_config_parse (void)
/* Now set things up for us as */
chown (GdmServAuthDir, 0, GdmGroupId);
chmod (GdmServAuthDir, (S_IRWXU|S_IRWXG|S_ISVTX));
g_chmod (GdmServAuthDir, (S_IRWXU|S_IRWXG|S_ISVTX));
NEVER_FAILS_root_set_euid_egid (GdmUserId, GdmGroupId);
......@@ -2089,7 +2089,7 @@ check_user_file (const char *path,
if (path == NULL)
return FALSE;
if (access (path, R_OK) != 0)
if (g_access (path, R_OK) != 0)
return FALSE;
dir = g_path_get_dirname (path);
......@@ -2115,7 +2115,7 @@ check_global_file (const char *path,
if (path == NULL)
return FALSE;
if (access (path, R_OK) != 0)
if (g_access (path, R_OK) != 0)
return FALSE;
return TRUE;
......@@ -2160,7 +2160,7 @@ get_facefile_from_gnome2_dir_config (const char *homedir,
if G_UNLIKELY (picfile != NULL &&
(picfile[0] != '/' ||
/* this catches readability by user */
access (picfile, R_OK) != 0)) {
g_access (picfile, R_OK) != 0)) {
g_free (picfile);
picfile = NULL;
}
......@@ -2215,7 +2215,7 @@ path_is_local (const char *path)
if (local == NULL) {
struct stat statbuf;
if (stat (path, &statbuf) == 0) {
if (g_stat (path, &statbuf) == 0) {
char *type = filesystem_type ((char *)path, (char *)path, &statbuf);
gboolean is_local = ((strcmp (ve_sure_string (type), "nfs") != 0) &&
(strcmp (ve_sure_string (type), "afs") != 0) &&
......@@ -2374,7 +2374,7 @@ gdm_get_session_exec (const char *session_name, gboolean check_try_exec)
g_free (file);
}
if (ve_string_empty (full) || access (full, R_OK) != 0) {
if (ve_string_empty (full) || g_access (full, R_OK) != 0) {
g_free (full);
if (gdm_is_session_magic (session_name)) {
exec = g_strdup (session_name);
......
......@@ -153,7 +153,8 @@ have_ipv6_solaris (void)
}
#endif
static gboolean have_ipv6 (void)
static gboolean
have_ipv6 (void)
{
int s;
static gboolean has_ipv6 = -1;
......@@ -515,7 +516,7 @@ gdm_get_free_display (int start, uid_t server_uid)
/* if lock file exists and the process exists */
g_snprintf (buf, sizeof (buf), "/tmp/.X%d-lock", i);
VE_IGNORE_EINTR (r = stat (buf, &s));
VE_IGNORE_EINTR (r = g_stat (buf, &s));
if (r == 0 &&
! S_ISREG (s.st_mode)) {
/*
......@@ -541,7 +542,7 @@ gdm_get_free_display (int start, uid_t server_uid)
VE_IGNORE_EINTR (fclose (fp));
/* whack the file, it's a stale lock file */
VE_IGNORE_EINTR (unlink (buf));
VE_IGNORE_EINTR (g_unlink (buf));
}
/* If starting as root, we'll be able to overwrite any
......@@ -550,7 +551,7 @@ gdm_get_free_display (int start, uid_t server_uid)
if (server_uid > 0) {
g_snprintf (buf, sizeof (buf),
"/tmp/.X11-unix/X%d", i);
VE_IGNORE_EINTR (r = stat (buf, &s));
VE_IGNORE_EINTR (r = g_stat (buf, &s));
if (r == 0 &&
s.st_uid != server_uid) {
continue;
......@@ -558,7 +559,7 @@ gdm_get_free_display (int start, uid_t server_uid)
g_snprintf (buf, sizeof (buf),
"/tmp/.X%d-lock", i);
VE_IGNORE_EINTR (r = stat (buf, &s));
VE_IGNORE_EINTR (r = g_stat (buf, &s));
if (r == 0 &&
s.st_uid != server_uid) {
continue;
......@@ -580,7 +581,7 @@ gdm_text_message_dialog (const char *msg)
if ( ! gdm_get_value_bool (GDM_KEY_CONSOLE_NOTIFY))
return FALSE;
if (access (EXPANDED_LIBEXECDIR "/gdmopen", X_OK) != 0)
if (g_access (EXPANDED_LIBEXECDIR "/gdmopen", X_OK) != 0)
return FALSE;
if (msg[0] == '-') {
......@@ -658,7 +659,7 @@ gdm_text_yesno_dialog (const char *msg, gboolean *ret)
if ( ! gdm_get_value_bool (GDM_KEY_CONSOLE_NOTIFY))
return FALSE;
if (access (EXPANDED_LIBEXECDIR "/gdmopen", X_OK) != 0)
if (g_access (EXPANDED_LIBEXECDIR "/gdmopen", X_OK) != 0)
return FALSE;
if (ret != NULL)
......@@ -766,7 +767,7 @@ gdm_text_yesno_dialog (const char *msg, gboolean *ret)
}
}
VE_IGNORE_EINTR (unlink (tempname));
VE_IGNORE_EINTR (g_unlink (tempname));
g_free (msg_quoted);
return TRUE;
......@@ -782,7 +783,7 @@ gdm_exec_wait (char * const *argv, gboolean no_display,
if (argv == NULL ||
argv[0] == NULL ||
access (argv[0], X_OK) != 0)
g_access (argv[0], X_OK) != 0)
return -1;
pid = gdm_fork_extra ();
......@@ -983,7 +984,7 @@ ensure_tmp_socket_dir (const char *dir)
*/
old_umask = umask (0);
if G_UNLIKELY (mkdir (dir, 01777) != 0) {
if G_UNLIKELY (g_mkdir (dir, 01777) != 0) {
/*
* If we can't create it, perhaps it
* already exists, in which case ensure the
......@@ -991,18 +992,18 @@ ensure_tmp_socket_dir (const char *dir)
*/
struct stat s;
int r;
VE_IGNORE_EINTR (r = lstat (dir, &s));
VE_IGNORE_EINTR (r = g_lstat (dir, &s));
if G_LIKELY (r == 0 && S_ISDIR (s.st_mode)) {
/* Make sure it is root and sticky */
VE_IGNORE_EINTR (chown (dir, 0, 0));
VE_IGNORE_EINTR (chmod (dir, 01777));
VE_IGNORE_EINTR (g_chmod (dir, 01777));
} else {
/*
* There is a file/link/whatever of the same name?
* whack and try mkdir
*/
VE_IGNORE_EINTR (unlink (dir));
mkdir (dir, 01777);
VE_IGNORE_EINTR (g_unlink (dir));
g_mkdir (dir, 01777);
}
}
......@@ -2041,7 +2042,7 @@ gdm_safe_fopen_w (const char *file)
{
int fd;
FILE *ret;
VE_IGNORE_EINTR (unlink (file));
VE_IGNORE_EINTR (g_unlink (file));
do {
errno = 0;
fd = open (file, O_EXCL|O_CREAT|O_TRUNC|O_WRONLY
......@@ -2066,7 +2067,7 @@ gdm_safe_fopen_ap (const char *file)
int fd;
FILE *ret;
if (access (file, F_OK) == 0) {
if (g_access (file, F_OK) == 0) {
do {
errno = 0;
fd = open (file, O_APPEND|O_RDWR
......@@ -2415,9 +2416,9 @@ gdm_get_last_info (const char *username)
char *info = NULL;
const char *cmd = NULL;
if G_LIKELY (access ("/usr/bin/last", X_OK) == 0)
if G_LIKELY (g_access ("/usr/bin/last", X_OK) == 0)
cmd = "/usr/bin/last";
else if (access ("/bin/last", X_OK) == 0)
else if (g_access ("/bin/last", X_OK) == 0)
cmd = "/bin/last";
if G_LIKELY (cmd != NULL) {
......
......@@ -86,12 +86,12 @@ gdm_server_whack_lockfile (GdmDisplay *disp)
/* if lock file exists and it is our process, whack it! */
g_snprintf (buf, sizeof (buf), "/tmp/.X%d-lock", disp->dispnum);
VE_IGNORE_EINTR (unlink (buf));
VE_IGNORE_EINTR (g_unlink (buf));
/* whack the unix socket as well */
g_snprintf (buf, sizeof (buf),
"/tmp/.X11-unix/X%d", disp->dispnum);
VE_IGNORE_EINTR (unlink (buf));
VE_IGNORE_EINTR (g_unlink (buf));
}
......@@ -100,12 +100,12 @@ void
gdm_server_wipe_cookies (GdmDisplay *disp)
{
if ( ! ve_string_empty (disp->authfile)) {
VE_IGNORE_EINTR (unlink (disp->authfile));
VE_IGNORE_EINTR (g_unlink (disp->authfile));
}
g_free (disp->authfile);
disp->authfile = NULL;
if ( ! ve_string_empty (disp->authfile_gdm)) {
VE_IGNORE_EINTR (unlink (disp->authfile_gdm));
VE_IGNORE_EINTR (g_unlink (disp->authfile_gdm));
}
g_free (disp->authfile_gdm);
disp->authfile_gdm = NULL;
......@@ -335,7 +335,7 @@ static gboolean
busy_ask_user (GdmDisplay *disp)
{
/* if we have "open" we can talk to the user */
if (access (EXPANDED_LIBEXECDIR "/gdmopen", X_OK) == 0) {
if (g_access (EXPANDED_LIBEXECDIR "/gdmopen", X_OK) == 0) {
char *error = g_strdup_printf
(C_(N_("There already appears to be an X server "
"running on display %s. Should another "
......@@ -905,16 +905,16 @@ safer_rename (const char *a, const char *b)
errno = 0;
if (link (a, b) < 0) {
if (errno == EEXIST) {
VE_IGNORE_EINTR (unlink (a));
VE_IGNORE_EINTR (g_unlink (a));
return;
}
VE_IGNORE_EINTR (unlink (b));
VE_IGNORE_EINTR (g_unlink (b));
/* likely this system doesn't support hard links */
rename (a, b);
VE_IGNORE_EINTR (unlink (a));
g_rename (a, b);
VE_IGNORE_EINTR (g_unlink (a));
return;
}
VE_IGNORE_EINTR (unlink (a));
VE_IGNORE_EINTR (g_unlink (a));
}
static void
......@@ -930,7 +930,7 @@ rotate_logs (const char *dname)
char *fname = gdm_make_filename (logdir, dname, ".log");
/* Rotate the logs (keep 4 last) */
VE_IGNORE_EINTR (unlink (fname4));
VE_IGNORE_EINTR (g_unlink (fname4));
safer_rename (fname3, fname4);
safer_rename (fname2, fname3);
safer_rename (fname1, fname2);
......@@ -1148,7 +1148,7 @@ gdm_server_spawn (GdmDisplay *d, const char *vtarg)
/* Log all output from spawned programs to a file */
logfile = gdm_make_filename (gdm_get_value_string (GDM_KEY_LOG_DIR), d->name, ".log");
VE_IGNORE_EINTR (unlink (logfile));
VE_IGNORE_EINTR (g_unlink (logfile));
VE_IGNORE_EINTR (logfd = open (logfile, O_CREAT|O_TRUNC|O_WRONLY|O_EXCL, 0644));
if (logfd != -1) {
......@@ -1296,7 +1296,7 @@ gdm_server_spawn (GdmDisplay *d, const char *vtarg)
char old_pipe[MAXPATHLEN];
sprintf (old_pipe, "%s/%d", SDTLOGIN_DIR, d->name);
unlink (old_pipe);
g_unlink (old_pipe);
}
#endif
......