Skip to content

Commit

Permalink
libsemanage: drop duplicate newlines and error descriptions in error …
Browse files Browse the repository at this point in the history
…messages

The ERR macro already appends the errno description and a trailing
newline.

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
  • Loading branch information
cgzones authored and bachradsusi committed Nov 27, 2024
1 parent dcd755a commit ba766fa
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 65 deletions.
4 changes: 2 additions & 2 deletions libsemanage/src/compressed_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,13 @@ int map_compressed_file(semanage_handle_t *sh, const char *path,

fd = open(path, O_RDONLY | O_CLOEXEC);
if (fd == -1) {
ERR(sh, "Unable to open %s\n", path);
ERR(sh, "Unable to open %s.", path);
return -1;
}

file = fdopen(fd, "r");
if (file == NULL) {
ERR(sh, "Unable to open %s\n", path);
ERR(sh, "Unable to open %s.", path);
close(fd);
return -1;
}
Expand Down
4 changes: 2 additions & 2 deletions libsemanage/src/database_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ static int dbase_file_flush(semanage_handle_t * handle, dbase_file_t * dbase)
str = fopen(fname, "we");
umask(mask);
if (!str) {
ERR(handle, "could not open %s for writing: %s",
fname, strerror(errno));
ERR(handle, "could not open %s for writing",
fname);
goto err;
}
__fsetlocking(str, FSETLOCKING_BYCALLER);
Expand Down
4 changes: 2 additions & 2 deletions libsemanage/src/database_policydb.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ static int dbase_policydb_cache(semanage_handle_t * handle,
* ENOENT is not fatal - we just create an empty policydb */
fp = fopen(fname, "rbe");
if (fp == NULL && errno != ENOENT) {
ERR(handle, "could not open %s for reading: %s",
fname, strerror(errno));
ERR(handle, "could not open %s for reading",
fname);
goto err;
}

Expand Down
Loading

0 comments on commit ba766fa

Please sign in to comment.