gdm r6653 - in branches/gnome-2-20: . daemon



Author: bcameron
Date: Tue Jan  6 14:26:15 2009
New Revision: 6653
URL: http://svn.gnome.org/viewvc/gdm?rev=6653&view=rev

Log:
2009-01-06 Brian Cameron <brian cameron sun com>

        * daemon/gdm.c, daemon/auth.c, daemon/misc.c:  Use g_remove instead
          of g_unlink when removing directories, it is safer.


Modified:
   branches/gnome-2-20/ChangeLog
   branches/gnome-2-20/daemon/auth.c
   branches/gnome-2-20/daemon/gdm.c
   branches/gnome-2-20/daemon/misc.c

Modified: branches/gnome-2-20/daemon/auth.c
==============================================================================
--- branches/gnome-2-20/daemon/auth.c	(original)
+++ branches/gnome-2-20/daemon/auth.c	Tue Jan  6 14:26:15 2009
@@ -628,7 +628,7 @@
 		   was of wrong permissions, but more likely this is
 		   file on NFS dir with root-squashing enabled) */
 		if ( ! user_auth_exists && d->userauth != NULL)
-			g_unlink (d->userauth);
+			g_remove (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) */
@@ -789,7 +789,7 @@
 	/* If we are using the fallback cookie location, simply nuke the
 	 * cookie file */
 	if (d->authfb) {
-		VE_IGNORE_EINTR (g_unlink (d->userauth));
+		VE_IGNORE_EINTR (g_remove (d->userauth));
 		g_free (d->userauth);
 		d->userauth = NULL;
 		return;
@@ -962,7 +962,7 @@
 
 	if (remove_when_empty &&
 	    keep == NULL) {
-		VE_IGNORE_EINTR (g_unlink (d->userauth));
+		VE_IGNORE_EINTR (g_remove (d->userauth));
 		return NULL;
 	}
 

Modified: branches/gnome-2-20/daemon/gdm.c
==============================================================================
--- branches/gnome-2-20/daemon/gdm.c	(original)
+++ branches/gnome-2-20/daemon/gdm.c	Tue Jan  6 14:26:15 2009
@@ -410,43 +410,6 @@
 	gdm_daemon_config_close ();
 }
 
-#ifdef __sun
-void
-gdm_rmdir (char *thedir)
-{
-	DIR *odir;
-	struct stat buf;
-	struct dirent *dp;
-	char thefile[FILENAME_MAX];
-
-	if ((stat(thedir, &buf) == -1) || ! S_ISDIR(buf.st_mode))
-		return ;
-
-	if ((rmdir (thedir) == -1) && (errno == EEXIST))
-		{
-			odir = opendir (thedir);
-			do {
-				errno = 0;
-				if ((dp = readdir (odir)) != NULL)
-					{
-						if (strcmp (dp->d_name, ".") == 0 ||
-						    strcmp (dp->d_name, "..") == 0)
-							continue ;
-						snprintf (thefile, FILENAME_MAX, "%s/%s", thedir, dp->d_name);
-						if (stat (thefile, &buf) == -1)
-							continue ;
-						if (S_ISDIR(buf.st_mode))
-							gdm_rmdir (thefile);
-						else
-							g_unlink (thefile);
-					}
-			} while (dp != NULL);
-			closedir (odir);
-			rmdir (thedir);
-		}
-}
-#endif
-
 static gboolean
 deal_with_x_crashes (GdmDisplay *d)
 {
@@ -1716,7 +1679,7 @@
 			g_mkdir (GDM_DT_DIR, 0755);
 		}
 		
-		g_unlink (GDM_SDTLOGIN_DIR);
+		g_remove (GDM_SDTLOGIN_DIR);
 		g_mkdir (GDM_SDTLOGIN_DIR, 0700);
 	}
 #endif

Modified: branches/gnome-2-20/daemon/misc.c
==============================================================================
--- branches/gnome-2-20/daemon/misc.c	(original)
+++ branches/gnome-2-20/daemon/misc.c	Tue Jan  6 14:26:15 2009
@@ -862,7 +862,7 @@
                          * There is a file/link/whatever of the same name?
 			 * whack and try mkdir
                          */
-			VE_IGNORE_EINTR (g_unlink (dir));
+			VE_IGNORE_EINTR (g_remove (dir));
 			g_mkdir (dir, 01777);
 		}
 	}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]