From: Brian McGillion Date: Fri, 11 Nov 2011 08:47:49 +0000 (+0200) Subject: Add smackcipso X-Git-Tag: accepted/trunk/20130107.204027~42^2^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6e48dd01157083446ad968c1dd6110ce216faac8;p=platform%2Fupstream%2Fsmack.git Add smackcipso --- diff --git a/utils/Makefile.am b/utils/Makefile.am index be466ae..2cc098c 100644 --- a/utils/Makefile.am +++ b/utils/Makefile.am @@ -1,5 +1,5 @@ instdir = ${bindir} -inst_PROGRAMS = smackctl smackaccess smackself smackload +inst_PROGRAMS = smackctl smackaccess smackself smackload smackcipso AM_CPPFLAGS = \ -I$(top_srcdir)/libsmack @@ -14,3 +14,6 @@ smackself_LDADD = ../libsmack/libsmack.la smackload_SOURCES = smackload.c common.c smackload_LDADD = ../libsmack/libsmack.la + +smackcipso_SOURCES = smackcipso.c common.c +smackcipso_LDADD = ../libsmack/libsmack.la diff --git a/utils/smackcipso.c b/utils/smackcipso.c new file mode 100644 index 0000000..74ebce5 --- /dev/null +++ b/utils/smackcipso.c @@ -0,0 +1,41 @@ +/* + * This file is part of libsmack + * + * Copyright (C) 2011 Intel Corporation + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * version 2.1 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + * + * Authors: + * Brian McGillion + */ + +#include "common.h" +#include +#include + +int main(int argc, char **argv) +{ + if (argc != 2) { + fprintf(stderr, "Usage: %s \n", argv[0]); + exit(1); + } + + if (apply_cipso(argv[1])) { + perror("Failure to apply cipso : "); + exit(1); + } + + exit(0); +} diff --git a/utils/smackload.c b/utils/smackload.c index af93153..17d3888 100644 --- a/utils/smackload.c +++ b/utils/smackload.c @@ -26,7 +26,7 @@ #include #include -static int usage(const char *bin) +static void usage(const char *bin) { fprintf(stderr, "Usage: %s [-c] \n", bin); exit(1); @@ -52,11 +52,13 @@ int main(int argc, char **argv) if (is_smackfs_mounted() != 1) { fprintf(stderr, "ERROR: SmackFS is not mounted.\n"); - return -1; + exit(1); } - if (apply_rules(argv[optind], clear)) - perror("Applying rules"); + if (apply_rules(argv[optind], clear)) { + perror("Failure applying rules : "); + exit(1); + } exit(0); }