|
From: <kma...@us...> - 2007-02-08 14:59:22
|
Revision: 2229
http://svn.sourceforge.net/selinux/?rev=2229&view=rev
Author: kmacmillan
Date: 2007-02-08 06:59:08 -0800 (Thu, 08 Feb 2007)
Log Message:
-----------
Author: Daniel J Walsh
Email: dw...@re...
Subject: Small patch to allow semodule_deps to build
Date: Wed, 07 Feb 2007 16:52:14 -0500
Acked-by: Karl MacMillan <kma...@me...>
Modified Paths:
--------------
trunk/libselinux/src/matchpathcon.c
trunk/policycoreutils/semodule_deps/semodule_deps.c
Modified: trunk/libselinux/src/matchpathcon.c
===================================================================
--- trunk/libselinux/src/matchpathcon.c 2007-02-06 16:42:56 UTC (rev 2228)
+++ trunk/libselinux/src/matchpathcon.c 2007-02-08 14:59:08 UTC (rev 2229)
@@ -443,7 +443,7 @@
static int process_line(const char *path, const char *prefix, char *line_buf,
int pass, unsigned lineno)
{
- int items, len, regerr, ret;
+ int len, regerr, ret;
char *buf_p, *ptr;
char *regex, *type, *context;
const char *reg_buf;
@@ -460,42 +460,42 @@
if (*buf_p == '#' || *buf_p == 0)
return 0;
- items = 0;
regex = strtok_r(buf_p, " \t", &ptr);
- if (regex)
- items += 1;
- type = strtok_r(NULL, " \t", &ptr);
- if (type)
- items += 1;
- context = strtok_r(NULL, " \t", &ptr);
- if (context)
- items += 1;
-
- if (items < 2) {
+ if (!regex) {
myprintf("%s: line %d is missing fields, skipping\n", path,
lineno);
- return 0;
- } else if (items == 2) {
- /* The type field is optional. */
- context = type;
- type = NULL;
+ return 0;
+ } else {
+ regex = strdup(regex);
+ if (!regex) {
+ return -1;
+ }
}
- regex = strdup(regex);
- if (!regex) {
- return -1;
- }
- if (type) {
+ type = strtok_r(NULL, " \t", &ptr);
+ if (!type) {
+ myprintf("%s: line %d is missing fields, skipping\n", path,
+ lineno);
+ return 0;
+ } else {
type = strdup(type);
if (!type) {
ret = -1;
goto finish;
}
}
- context = strdup(context);
+
+ context = strtok_r(NULL, " \t", &ptr);
if (!context) {
- ret = -1;
- goto finish;
+ /* The type field is optional. */
+ context = type;
+ type = NULL;
+ } else {
+ context = strdup(context);
+ if (!context) {
+ ret = -1;
+ goto finish;
+ }
}
reg_buf = regex;
Modified: trunk/policycoreutils/semodule_deps/semodule_deps.c
===================================================================
--- trunk/policycoreutils/semodule_deps/semodule_deps.c 2007-02-06 16:42:56 UTC (rev 2228)
+++ trunk/policycoreutils/semodule_deps/semodule_deps.c 2007-02-08 14:59:08 UTC (rev 2229)
@@ -16,7 +16,7 @@
* of avrule_blocks - even in an ABI safe way - seems undesirable.
*/
#include <sepol/module.h>
-#include <sepol/errno.h>
+#include <sepol/errcodes.h>
#include <sepol/policydb/policydb.h>
#include <getopt.h>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|