1999-02-28 Miguel de Icaza <miguel@nuclecu.unam.mx>

* gnome-file-property-dialog.c (perm_group_new): Check the return
	value of getgrgid.
	(perm_group_new): Do not use a grp if it does not exist.
This commit is contained in:
Miguel de Icaza 1999-02-28 07:19:33 +00:00
parent 3481777d46
commit 3a6fa38650
2 changed files with 20 additions and 6 deletions

View File

@ -1,3 +1,9 @@
1999-02-28 Miguel de Icaza <miguel@nuclecu.unam.mx>
* gnome-file-property-dialog.c (perm_group_new): Check the return
value of getgrgid.
(perm_group_new): Do not use a grp if it does not exist.
1999-02-26 Miguel de Icaza <miguel@nuclecu.unam.mx>
* glayout.c (my_app_create_menus): New function, used to create

View File

@ -826,10 +826,15 @@ perm_group_new (GnomeFilePropertyDialog *fp_dlg)
if ((fp_dlg->euid == 0) || (fp_dlg->st.st_uid == fp_dlg->euid)) {
gentry = gtk_combo_new ();
grp = getgrgid (fp_dlg->st.st_gid);
if (grp->gr_name)
fp_dlg->group_name = g_strdup (grp->gr_name);
else {
sprintf (grpnum, "%d", (int) grp->gr_gid);
if (grp){
if (grp->gr_name)
fp_dlg->group_name = g_strdup (grp->gr_name);
else {
sprintf (grpnum, "%d", (int) grp->gr_gid);
fp_dlg->group_name = g_strdup (grpnum);
}
} else {
sprintf (grpnum, "%d", (int) fp_dlg->st.st_gid);
fp_dlg->group_name = g_strdup (grpnum);
}
@ -842,7 +847,11 @@ perm_group_new (GnomeFilePropertyDialog *fp_dlg)
sprintf (grpnum, "%d", (int) grp->gr_gid);
grpname = grpnum;
}
} else {
sprintf (grpnum, "%d", (int) grp->gr_gid);
grpname = grpnum;
}
if (fp_dlg->euid != 0)
gtk_editable_set_editable (GTK_EDITABLE (GTK_COMBO (gentry)->entry), FALSE);
for (setgrent (); (grp = getgrent ()) != NULL;) {
@ -876,8 +885,7 @@ perm_group_new (GnomeFilePropertyDialog *fp_dlg)
for (templist = list; templist; templist = templist->next) {
g_free (templist->data);
}
grp = getgrgid (fp_dlg->st.st_gid);
gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (gentry)->entry), grp->gr_name);
gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (gentry)->entry), grpname);
g_list_free (list);
} else {
/* we're neither so we just put an entry down */