2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-22 10:07:12 +00:00

parser: Don't use gettext(3) in code that will be moved to libapparmor

Remove the use of the "_" macro, which translates into gettext(3), from
code that will be used from the parser to libapparmor since libapparmor
will not support gettext(3) for debug messages and syslog messages.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: John Johansen <john.johansen@canonical.com>
This commit is contained in:
Tyler Hicks 2015-03-25 17:09:27 -05:00
parent ab181805f7
commit 1d60aca8a8
2 changed files with 8 additions and 14 deletions

View File

@ -26,9 +26,6 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <libintl.h>
#include <locale.h>
#define _(s) gettext(s)
#include "features.h"
#include "lib.h"
@ -61,7 +58,7 @@ static int features_snprintf(struct features_struct *fst, const char *fmt, ...)
if (remaining < 0) {
errno = EINVAL;
PERROR(_("Invalid features buffer offset\n"));
PERROR("Invalid features buffer offset\n");
return -1;
}
@ -71,11 +68,11 @@ static int features_snprintf(struct features_struct *fst, const char *fmt, ...)
if (i < 0) {
errno = EIO;
PERROR(_("Failed to write to features buffer\n"));
PERROR("Failed to write to features buffer\n");
return -1;
} else if (i >= remaining) {
errno = ENOBUFS;
PERROR(_("Feature buffer full."));
PERROR("Feature buffer full.");
return -1;
}

View File

@ -18,8 +18,6 @@
#include <ctype.h>
#include <dirent.h>
#include <libintl.h>
#include <locale.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@ -27,7 +25,6 @@
#include <sys/types.h>
#include <unistd.h>
#include <sys/stat.h>
#define _(s) gettext(s)
#include "lib.h"
#include "parser.h"
@ -50,7 +47,7 @@ bool valid_cached_file_version(const char *cachename)
char buffer[16];
autofclose FILE *f;
if (!(f = fopen(cachename, "r"))) {
PERROR(_("Error: Could not read cache file '%s', skipping...\n"), cachename);
PERROR("Error: Could not read cache file '%s', skipping...\n", cachename);
return false;
}
size_t res = fread(buffer, 1, 16, f);
@ -133,15 +130,15 @@ error:
if (mkdir(policy_cache->path, 0700) == 0)
goto create_file;
if (show_cache)
PERROR(_("Can't create cache directory: %s\n"),
PERROR("Can't create cache directory: %s\n",
policy_cache->path);
} else if (!S_ISDIR(stat_file.st_mode)) {
if (show_cache)
PERROR(_("File in cache directory location: %s\n"),
PERROR("File in cache directory location: %s\n",
policy_cache->path);
} else {
if (show_cache)
PERROR(_("Can't update cache directory: %s\n"),
PERROR("Can't update cache directory: %s\n",
policy_cache->path);
}
@ -158,7 +155,7 @@ char *cache_filename(const char *cachedir, const char *basename)
char *cachename;
if (asprintf(&cachename, "%s/%s", cachedir, basename) < 0) {
PERROR(_("Memory allocation error."));
PERROR("Memory allocation error.");
exit(1);
}