libsemanage/libsemanage-fedora.patch

82 lines
1.9 KiB
Diff

diff --git libsemanage-2.9-rc1/src/direct_api.c libsemanage-2.9-rc1/src/direct_api.c
index c58961b..8e4d116 100644
--- libsemanage-2.9-rc1/src/direct_api.c
+++ libsemanage-2.9-rc1/src/direct_api.c
@@ -1028,7 +1028,7 @@ static int semanage_direct_write_langext(semanage_handle_t *sh,
fp = NULL;
- ret = 0;
+ return 0;
cleanup:
if (fp != NULL) fclose(fp);
@@ -2177,7 +2177,6 @@ cleanup:
semanage_module_info_destroy(sh, modinfo);
free(modinfo);
- if (fp != NULL) fclose(fp);
return status;
}
@@ -2342,16 +2341,6 @@ static int semanage_direct_get_module_info(semanage_handle_t *sh,
free(tmp);
tmp = NULL;
- if (fclose(fp) != 0) {
- ERR(sh,
- "Unable to close %s module lang ext file.",
- (*modinfo)->name);
- status = -1;
- goto cleanup;
- }
-
- fp = NULL;
-
/* lookup enabled/disabled status */
ret = semanage_module_get_path(sh,
*modinfo,
@@ -2395,7 +2384,13 @@ cleanup:
free(modinfos);
}
- if (fp != NULL) fclose(fp);
+ if (fp != NULL && fclose(fp) != 0) {
+ ERR(sh,
+ "Unable to close %s module lang ext file.",
+ (*modinfo)->name);
+ status = -1;
+ }
+
return status;
}
diff --git libsemanage-2.9-rc1/src/genhomedircon.c libsemanage-2.9-rc1/src/genhomedircon.c
index 591941f..ac37667 100644
--- libsemanage-2.9-rc1/src/genhomedircon.c
+++ libsemanage-2.9-rc1/src/genhomedircon.c
@@ -1077,10 +1077,20 @@ static int get_group_users(genhomedircon_settings_t * s,
const char *grname = selogin + 1;
- if (getgrnam_r(grname, &grstorage, grbuf,
- (size_t) grbuflen, &group) != 0) {
- goto cleanup;
+ errno = 0;
+ while (
+ (retval = getgrnam_r(grname, &grstorage, grbuf, (size_t) grbuflen, &group)) != 0 &&
+ errno == ERANGE
+ ) {
+ char *new_grbuf;
+ grbuflen *= 2;
+ new_grbuf = realloc(grbuf, grbuflen);
+ if (new_grbuf == NULL)
+ goto cleanup;
+ grbuf = new_grbuf;
}
+ if (retval == -1)
+ goto cleanup;
if (group == NULL) {
ERR(s->h_semanage, "Can't find group named %s\n", grname);