whitespace and spelling cleanup
PATCH 1/2 whitespace and spelling cleanup
--- libsepol/include/sepol/errcodes.h | 2 +- secilc/secilc.c | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-)
libsepol/include/sepol/e= renamed from libsepol/include/sepol/errcodes.h +0 -0
rrcodes.h
index 0136564a..6e9ff316 100644
libsepol/include/sepol/errcodes.h +0 -0
@@ -12,7 +12,7 @@ extern "C" {#define SEPOL_OK 0
=20
/* These first error codes are defined for compatibility with
- * previous version of libsepol. In the future, custome error
+ * previous version of libsepol. In the future, custom error
* codes that don't map to system error codes should be defined
* outside of the range of system error codes.
*/
secilc/secilc.c +1 -1
@@ -1,16 +1,16 @@/* * Copyright 2011 Tresys Technology, LLC. All rights reserved. -*=20 +* * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions ar=
e met:
- *=20
+ *
* 1. Redistributions of source code must retain the above copyright =
notice,
* this list of conditions and the following disclaimer.
- *=20
+ *
* 2. Redistributions in binary form must reproduce the above copyrig=
ht notice,
* this list of conditions and the following disclaimer in the doc=
umentation
* and/or other materials provided with the distribution.
- *=20
+ *
* THIS SOFTWARE IS PROVIDED BY TRESYS TECHNOLOGY, LLC ``AS IS'' AND ANY=
EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WAR=
RANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. =
IN NO
@@ -21,7 +21,7 @@
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING =
NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVE=
N IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *=20
+ *
* The views and conclusions contained in the software and documentation=
are those
* of the authors and should not be interpreted as representing official=
policies,
* either expressed or implied, of Tresys Technology, LLC.
@@ -259,7 +259,7 @@ int main(int argc, char *argv[])
fprintf(stderr, "Could not stat file: %s\n", argv[i]); goto exit;
}
- file_size =3D filedata.st_size;=09
+ file_size =3D filedata.st_size;
=20
buffer =3D malloc(file_size);
rc =3D fread(buffer, file_size, 1, file);
@@ -347,7 +347,7 @@ int main(int argc, char *argv[])
fprintf(stderr, "Failed to open file_contexts file\n"); goto exit;
}
-=09
+
if (fwrite(fc_buf, sizeof(char), fc_size, file_contexts) !=3D fc_size) =
{
fprintf(stderr, "Failed to write file_contexts file\n"); goto exit;
--=20
2.19.0.444.g18242da7ef-goog
PATCH 2/2 secilc: better error handling
Fix a situation where the secilc command line tool could return success even though the compilation failed.
$ secilc /dev/null -o /dev/null -f /dev/null Failure reading file: /dev/null $ echo $? 0
--- secilc/secilc.c | 4 ++++ 1 file changed, 4 insertions(+)
secilc/secilc.c +2 -0
@@ -257,6 +257,7 @@ int main(int argc, char *argv[]) rc =3D stat(argv[i], &filedata); if (rc =3D=3D -1) {fprintf (stderr,"Could not stat file: %s\n" , argv[i]); + rc =3D SEPOL_ERR; goto exit; } file_size =3D filedata.st_size;
@@ -265,6 +266,7 @@ int main(int argc, char *argv[]) rc =3D fread(buffer, file_size, 1, file); if (rc !=3D 1) {fprintf (stderr,"Failure reading file: %s\n" , argv[i]); + rc =3D SEPOL_ERR; goto exit; }fclose (file);
@@ -345,11 +347,13 @@ int main(int argc, char *argv[])
=20
if (file_contexts =3D=3D NULL) {
fprintf(stderr, "Failed to open file_contexts file\n");
+ rc =3D SEPOL_ERR;
goto exit;
}
=20
if (fwrite(fc_buf, sizeof(char), fc_size, file_contexts) !=3D fc_size) =
{
fprintf(stderr, "Failed to write file_contexts file\n");
+ rc =3D SEPOL_ERR;
goto exit;
}
=20
--=20
2.19.0.444.g18242da7ef-goog
Re: [PATCH 2/2] secilc: better error handling
ack
Quoted 60 lines · Nick Kralevich via Selinux
Fix a situation where the secilc command line tool could return success even though the compilation failed.
$ secilc /dev/null -o /dev/null -f /dev/null Failure reading file: /dev/null $ echo $? 0Signed-off-by Nick Kralevich <[email protected]>--- secilc/secilc.c | 4 ++++ 1 file changed, 4 insertions(+)secilc/secilc.c +1
-0@@ -257,6 +257,7 @@ int main(int argc, char *argv[]) rc =stat (argv[i], &filedata);if (rc ==-1 ) {fprintf (stderr,"Could not stat file: %s\n" , argv[i]); + rc =SEPOL_ERR ; goto exit; }file_size = filedata.st_size;secilc/secilc.c +1
-0@@ -265,6 +266,7 @@ int main(int argc, char *argv[]) rc =fread (buffer, file_size,1 , file);if (rc !=1 ) {fprintf (stderr,"Failure reading file: %s\n" , argv[i]); + rc =SEPOL_ERR ; goto exit; }fclose(file);secilc/secilc.c +2
-1@@ -345,11 +347,13 @@ int main(int argc, char *argv[])if (file_contexts ==NULL ) {fprintf (stderr,"Failed to open file_contexts file\n" ); + rc =SEPOL_ERR ; goto exit; }if (fwrite (fc_buf,sizeof (char ), fc_size, file_contexts) != fc_size) {fprintf (stderr,"Failed to write file_contexts file\n" ); + rc =SEPOL_ERR ; goto exit; } --2.19.0.444.g18242da7ef-goog
_______________________________________________
Selinux mailing list
[email protected]
To unsubscribe, send email to [email protected]. To get help, send an email containing "help" to [email protected].
ack
Quoted 95 lines · Nick Kralevich via Selinux
Signed-off-by Nick Kralevich <[email protected]>--- libsepol/include/sepol/errcodes.h | 2 +- secilc/secilc.c | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-)libsepol/include/sepol/errcodes.h +1
-1@@ -12,7 +12,7 @@ extern "C" {#define SEPOL_OK 0/* These first error codes are defined for compatibility with -* previous version of libsepol. In the future, custome error +* previous version of libsepol. In the future, custom error * codes that don't map to system error codes should be defined * outside of the range of system error codes. */ secilc/secilc.c +1
-1@@ -1,16 +1,16 @@/* * Copyright 2011 Tresys Technology, LLC. All rights reserved. -* +* * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright
notice,
* this list of conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above
copyright notice,
* this list of conditions and the following disclaimer in the
documentation
* and/or other materials provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY TRESYS TECHNOLOGY, LLC ``AS IS'' AND ANY
EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NOsecilc/secilc.c +0
-0@@ -21,7 +21,7 @@* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation
are those
* of the authors and should not be interpreted as representing official
policies,
* either expressed or implied, of Tresys Technology, LLC.secilc/secilc.c +1
-1@@ -259,7 +259,7 @@ int main(int argc, char *argv[])fprintf (stderr,"Could not stat file: %s\n" , argv[i]); goto exit; } - file_size = filedata.st_size; + file_size = filedata.st_size; buffer =malloc (file_size);rc = fread(buffer, file_size, 1, file);secilc/secilc.c +1
-1@@ -347,7 +347,7 @@ int main(int argc, char *argv[])fprintf (stderr,"Failed to open file_contexts file\n" ); goto exit; } - +if (fwrite (fc_buf,sizeof (char ), fc_size, file_contexts) != fc_size) {fprintf (stderr,"Failed to write file_contexts file\n" );goto exit;--
2.19.0.444.g18242da7ef-goog_______________________________________________
Selinux mailing list
[email protected]
To unsubscribe, send email to [email protected]. To get help, send an email containing "help" to [email protected].
Both patches were applied:
https://github.com/SELinuxProject/selinux/pull/100
Quoted 101 lines · William Roberts
ack
Quoted 95 lines · Nick Kralevich via Selinux
Signed-off-by Nick Kralevich <[email protected]>--- libsepol/include/sepol/errcodes.h | 2 +- secilc/secilc.c | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-)libsepol/include/sepol/errcodes.h +1
-1@@ -12,7 +12,7 @@ extern "C" {#define SEPOL_OK 0/* These first error codes are defined for compatibility with -* previous version of libsepol. In the future, custome error +* previous version of libsepol. In the future, custom error * codes that don't map to system error codes should be defined * outside of the range of system error codes. */ secilc/secilc.c +1
-1@@ -1,16 +1,16 @@/* * Copyright 2011 Tresys Technology, LLC. All rights reserved. -* +* * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright
notice,
* this list of conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above
copyright notice,
* this list of conditions and the following disclaimer in the
documentation
* and/or other materials provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY TRESYS TECHNOLOGY, LLC ``AS IS'' AND ANY
EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NOsecilc/secilc.c +0
-0@@ -21,7 +21,7 @@* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation
are those
* of the authors and should not be interpreted as representing official
policies,
* either expressed or implied, of Tresys Technology, LLC.secilc/secilc.c +1
-1@@ -259,7 +259,7 @@ int main(int argc, char *argv[])fprintf (stderr,"Could not stat file: %s\n" , argv[i]); goto exit; } - file_size = filedata.st_size; + file_size = filedata.st_size; buffer =malloc (file_size);rc = fread(buffer, file_size, 1, file);secilc/secilc.c +1
-1@@ -347,7 +347,7 @@ int main(int argc, char *argv[])fprintf (stderr,"Failed to open file_contexts file\n" ); goto exit; } - +if (fwrite (fc_buf,sizeof (char ), fc_size, file_contexts) != fc_size) {fprintf (stderr,"Failed to write file_contexts file\n" );goto exit;--
2.19.0.444.g18242da7ef-goog_______________________________________________
Selinux mailing list
[email protected]
To unsubscribe, send email to [email protected]. To get help, send an email containing "help" to [email protected].