[PATCH 09/11] pragma once: convert scripts/selinux/genheaders/genheaders.c

From: Alexey Dobriyan
Date: Mon Feb 08 2021 - 16:39:23 EST


Generate security/selinux/flask.h and security/selinux/av_permissions.h
without include guards.

Signed-off-by: Alexey Dobriyan <adobriyan@xxxxxxxxx>
---
scripts/selinux/genheaders/genheaders.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/scripts/selinux/genheaders/genheaders.c b/scripts/selinux/genheaders/genheaders.c
index f355b3e0e968..e13ee4221993 100644
--- a/scripts/selinux/genheaders/genheaders.c
+++ b/scripts/selinux/genheaders/genheaders.c
@@ -74,8 +74,8 @@ int main(int argc, char *argv[])
initial_sid_to_string[i] = stoupperx(s);
}

+ fprintf(fout, "#pragma once\n");
fprintf(fout, "/* This file is automatically generated. Do not edit. */\n");
- fprintf(fout, "#ifndef _SELINUX_FLASK_H_\n#define _SELINUX_FLASK_H_\n\n");

for (i = 0; secclass_map[i].name; i++) {
struct security_class_mapping *map = &secclass_map[i];
@@ -109,7 +109,6 @@ int main(int argc, char *argv[])
fprintf(fout, "\treturn sock;\n");
fprintf(fout, "}\n");

- fprintf(fout, "\n#endif\n");
fclose(fout);

fout = fopen(argv[2], "w");
@@ -119,8 +118,8 @@ int main(int argc, char *argv[])
exit(4);
}

+ fprintf(fout, "#pragma once\n");
fprintf(fout, "/* This file is automatically generated. Do not edit. */\n");
- fprintf(fout, "#ifndef _SELINUX_AV_PERMISSIONS_H_\n#define _SELINUX_AV_PERMISSIONS_H_\n\n");

for (i = 0; secclass_map[i].name; i++) {
struct security_class_mapping *map = &secclass_map[i];
@@ -136,7 +135,6 @@ int main(int argc, char *argv[])
}
}

- fprintf(fout, "\n#endif\n");
fclose(fout);
exit(0);
}
--
2.29.2