Commit Graph

5 Commits

Author SHA1 Message Date
Mark Johnston
8c8574acb8 config: Include errno.h in mkmakefile.cc
Commit da88842029 ("config: error out on malformed env/hint lines")
added a reference to EINVAL.  In some configurations the bootstrap tools
build fails for lack of errno definitions.

Fixes:	da88842029 ("config: error out on malformed env/hint lines")
Reported by:	syzbot+b1a5d112a737d9a2be9b@syzkaller.appspotmail.com
2023-02-23 21:53:06 -05:00
Kyle Evans
da88842029 config: error out on malformed env/hint lines
We need these to be assignments, error out if they're not.

While we're here, tag errout as __printflike so that the compiler will
sanity check the format string + args.

CID:	1505293
Reviewed by:	emaste, imp
Differential Revision:	https://reviews.freebsd.org/D38642
2023-02-16 14:37:05 -06:00
Kyle Evans
b2c5a01722 config: push path() into moveifchanged()
Every caller path()s its arguments anyways, just simplify these and push
path() into moveifchanged().  This fixes a number of memory leaks in the
process since path() allocates memory, which we will now free().

While we're here, make sure we close from_fd/to_fd appropriately.

CID:	1471040, 1471714, 1472045, 1006907, 1006908
Reviewed by:	emaste, imp
Differential Revision:	https://reviews.freebsd.org/D38641
2023-02-16 14:36:42 -06:00
Kyle Evans
83d7ed8af3 config: drop dependency on libsbuf
Use an std::stringstream instead.  get_word() and get_quoted_word() both
return a buffer that's presumed to not need release, so solve this by
returning a new special configword type that holds a string or eof/eol
state.  This cleans up caller checking for EOF/EOL to make it more
explicit what they're doing, at least in the EOL cases which previously
checked for NULL.

Sponsored by:	Klara, Inc.
Sponsored by:	NetApp, Inc.
Differential Revision:	https://reviews.freebsd.org/D38276
2023-02-08 22:56:10 -06:00
Kyle Evans
29c5f8bf9a config: drop dependency on libnv
Compile mkmakefile.c as C++ instead and use an std::unordered_map to
accomplish the same goal.

Reviewed by:	imp
Sponsored by:	Klara, Inc.
Sponsored by:	NetApp, Inc.
Differential Revision:	https://reviews.freebsd.org/D38275
2023-02-08 00:09:19 -06:00