fnc

Check-in [9b191697d6]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Improve robustness and guard against abuse with piped input.

Reported by Dan on the list^. This will suffice for now but will take another
approach once the test harness is finished as we pipe input for our test cases.
^https://itac.bsdbox.org/pipermail/fnc/2022-March/000037.html

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 9b191697d6c619a0d59f9452c05e8b7349aaf3ec65ee932c6cfcd78f22176ee2
User & Date: mark 2022-03-26 13:10:25
Context
2022-03-26 15:33
Document UTF-8 preference and font-dependent rendering. (check-in: 45b98d6c5e user: mark tags: trunk)
2022-03-26 13:10
Improve robustness and guard against abuse with piped input. (check-in: 9b191697d6 user: mark tags: trunk)
2022-03-26 11:47
Replace getpagesize() with portable sysconf(_SC_PAGESIZE). (check-in: 3be331baf7 user: mark tags: trunk)
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/fnc.c.

1227
1228
1229
1230
1231
1232
1233









1234
1235
1236
1237
1238
1239
1240
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249







+
+
+
+
+
+
+
+
+








int
main(int argc, const char **argv)
{
	fcli_command	*cmd = NULL;
	char		*path = NULL;
	int		 rc = 0;

	/*
	 * XXX Guard against misuse. Will have to take another approach once
	 * the test harness is finished as we pipe input for our tests cases.
	 */
	if (!isatty(fileno(stdin))) {
		rc = RC(FSL_RC_MISUSE, "%s", "invalid input device");
		goto end;
	}

	if (!setlocale(LC_CTYPE, ""))
		fsl_fprintf(stderr, "[!] Warning: Can't set locale.\n");

	fnc_init.cmdarg = argv[1];	/* Which cmd to show usage if needed. */
#if DEBUG
	fcli.clientFlags.verbose = 2;	/* Verbose error reporting. */