From 3a6fa386509f3447c57c0eb421ffb5c036da041d Mon Sep 17 00:00:00 2001 From: Miguel de Icaza Date: Sun, 28 Feb 1999 07:19:33 +0000 Subject: [PATCH] 1999-02-28 Miguel de Icaza * 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. --- gnome/ChangeLog | 6 ++++++ gnome/gnome-file-property-dialog.c | 20 ++++++++++++++------ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/gnome/ChangeLog b/gnome/ChangeLog index 6d8300a08..4e5fe4b9b 100644 --- a/gnome/ChangeLog +++ b/gnome/ChangeLog @@ -1,3 +1,9 @@ +1999-02-28 Miguel de Icaza + + * 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 * glayout.c (my_app_create_menus): New function, used to create diff --git a/gnome/gnome-file-property-dialog.c b/gnome/gnome-file-property-dialog.c index 150d5c92e..17d55b4fa 100644 --- a/gnome/gnome-file-property-dialog.c +++ b/gnome/gnome-file-property-dialog.c @@ -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 */