Revision
831
Author
wsiegrist@apple.com
Date
2010-06-09 11:53:19 -0700 (Wed, 09 Jun 2010)

Log Message

Check for and handle errors from getgrnam()

Modified Paths

Diff

Modified: branches/PR-7872907/darwinup/Depot.cpp (830 => 831)


--- branches/PR-7872907/darwinup/Depot.cpp	2010-06-09 18:23:53 UTC (rev 830)
+++ branches/PR-7872907/darwinup/Depot.cpp	2010-06-09 18:53:19 UTC (rev 831)
@@ -107,8 +107,11 @@
 
 int Depot::create_storage() {
 	uid_t uid = getuid();
+	gid_t gid = 0;
 	struct group *gs = getgrnam("admin");
-	gid_t gid = gs->gr_gid;
+	if (gs) {
+		gid = gs->gr_gid;
+	}
 	
 	int res = mkdir(m_depot_path, m_depot_mode);
 	res = chmod(m_depot_path, m_depot_mode);