diff options
Diffstat (limited to 'src/label_file.h')
-rw-r--r-- | src/label_file.h | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/label_file.h b/src/label_file.h index 035315d..901a3d9 100644 --- a/src/label_file.h +++ b/src/label_file.h @@ -1,6 +1,9 @@ #ifndef _SELABEL_FILE_H_ #define _SELABEL_FILE_H_ +#include <errno.h> +#include <string.h> + #include <sys/stat.h> #include "callbacks.h" @@ -390,8 +393,17 @@ static inline int process_line(struct selabel_handle *rec, unsigned int nspec = data->nspec; const char *errbuf = NULL; - items = read_spec_entries(line_buf, 3, ®ex, &type, &context); - if (items <= 0) + items = read_spec_entries(line_buf, &errbuf, 3, ®ex, &type, &context); + if (items < 0) { + rc = errno; + selinux_log(SELINUX_ERROR, + "%s: line %u error due to: %s\n", path, + lineno, errbuf ?: strerror(errno)); + errno = rc; + return -1; + } + + if (items == 0) return items; if (items < 2) { |