tree-wide: do not use "re" with fmemopen

The man page says nothing about "e". Glibc clearly accepts it without fuss, but
it is meaningless for a memory object (and probably doesn't work). This use is
not portable, so let's avoid it.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2022-10-19 10:10:57 +02:00
parent dc1768131a
commit f3bd4b3df5
4 changed files with 6 additions and 6 deletions
+2 -2
View File
@@ -677,7 +677,7 @@ TEST(fgetc) {
_cleanup_fclose_ FILE *f = NULL;
char c;
assert_se(f = fmemopen_unlocked((void*) chars, sizeof(chars), "re"));
assert_se(f = fmemopen_unlocked((void*) chars, sizeof(chars), "r"));
for (size_t i = 0; i < sizeof(chars); i++) {
assert_se(safe_fgetc(f, &c) == 1);
@@ -770,7 +770,7 @@ static void test_read_line_one_file(FILE *f) {
TEST(read_line1) {
_cleanup_fclose_ FILE *f = NULL;
assert_se(f = fmemopen_unlocked((void*) buffer, sizeof(buffer), "re"));
assert_se(f = fmemopen_unlocked((void*) buffer, sizeof(buffer), "r"));
test_read_line_one_file(f);
}
+1 -1
View File
@@ -21,7 +21,7 @@ static void test_libmount_unescaping_one(
_cleanup_(mnt_free_iterp) struct libmnt_iter *iter = NULL;
_cleanup_fclose_ FILE *f = NULL;
f = fmemopen((char*) string, strlen(string), "re");
f = fmemopen((char*) string, strlen(string), "r");
assert_se(f);
assert_se(libmount_parse(title, f, &table, &iter) >= 0);