summaryrefslogtreecommitdiffstats
path: root/usr.sbin/config
diff options
context:
space:
mode:
authorwkoszek <wkoszek@FreeBSD.org>2013-05-01 05:14:59 +0000
committerwkoszek <wkoszek@FreeBSD.org>2013-05-01 05:14:59 +0000
commitfaa1380e8474053e5dd2f4129411639eff44f322 (patch)
treef2945387f38d2b5da065b257db4220028219330f /usr.sbin/config
parent4d50cec7052469379ca421b218ddd83b5d3286d8 (diff)
downloadFreeBSD-src-faa1380e8474053e5dd2f4129411639eff44f322.zip
FreeBSD-src-faa1380e8474053e5dd2f4129411639eff44f322.tar.gz
Make the internal assertion correct--only fail when '\0' is found in
places other than the end of the test section. Otherwise, with kernel compiled with Clang which happens to be setting ELF section alignment differently config(8) was throwing assert() failure unnecessarily Reported by: Kimmo Paasiala <kpaasial (at) gmail.com> Tested by: Kimmo Paasiala <kpaasial (at) gmail.com> MFC after: 10 days
Diffstat (limited to 'usr.sbin/config')
-rw-r--r--usr.sbin/config/main.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/usr.sbin/config/main.c b/usr.sbin/config/main.c
index 3ed5495..78bb13d 100644
--- a/usr.sbin/config/main.c
+++ b/usr.sbin/config/main.c
@@ -706,17 +706,11 @@ kernconfdump(const char *file)
r = fgetc(fp);
if (r == EOF)
break;
- /*
- * If '\0' is present in the middle of the configuration
- * string, this means something very weird is happening.
- * Make such case very visible. However, some architectures
- * pad the length of the section with NULs to a multiple of
- * sh_addralign, allow a NUL in that part of the section.
- */
- if (r == '\0' && (size - i) < align)
+ if (r == '\0') {
+ assert(i == size - 1 &&
+ ("\\0 found in the middle of a file"));
break;
- assert(r != '\0' && ("Char present in the configuration "
- "string mustn't be equal to 0"));
+ }
fputc(r, stdout);
}
fclose(fp);
OpenPOWER on IntegriCloud