From nobody Tue Jan 25 16:57:25 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id EC5D91973AF3; Tue, 25 Jan 2022 16:57:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JjtLs63vvz4hMS; Tue, 25 Jan 2022 16:57:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1643129845; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wnEOOsIwOIY/Xtl3iOKVyCTwdbWCf23raaJpQZ7k+GA=; b=u6wY8aNnfpQrmcvYYM7v+yy+yHak+kFHQMkvao4m6tRwecnMe6aUnE2T4dEYh2UrDHdEp3 uj9n2eq7SJxkHqEwnYCZu7WwEFME1k8/QD9yAIjHLq27NFTndjLN084ngLNJ8af1KbG9BG qlaMS1DIR1qr9KuXWBh5RkCO9CC5j6avTDRR2n9WB1Iszw0GgZVuhpeTNnW5vZAMtVGh9g dHP/DJpdCS/cjoBGYjyQcQdsLHavTW1miYu9hjdsTjD/X3xcSQ492EP2JhK9inMeBILAkW 85E/KVXAfbdURyI5ei5a7UVdoURdD+LXfZ3+bEk5C8yk911JETVqqA6FIbE7ew== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A86E252FC; Tue, 25 Jan 2022 16:57:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 20PGvP2A074538; Tue, 25 Jan 2022 16:57:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 20PGvPWP074537; Tue, 25 Jan 2022 16:57:25 GMT (envelope-from git) Date: Tue, 25 Jan 2022 16:57:25 GMT Message-Id: <202201251657.20PGvPWP074537@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wolfram Schneider Subject: git: ccf50c1df9cf - main - locate statistics: non zero exit on corrupt database List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wosch X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ccf50c1df9cf1379e337f695672fecf8331f4706 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1643129845; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wnEOOsIwOIY/Xtl3iOKVyCTwdbWCf23raaJpQZ7k+GA=; b=xGcFv7wQ8nxhhoP7R1ueZ4sJDF5RLxMhuj6RMysL5hXyjZrPmdXZ5un9zC+yFAgRbtDNen LknZpDiJM1xi3FUTk6x6ktFf3QzndMaKLNz3iq6c5/DdiukpmC1/bYEustsIhVNe100EM2 fbwZLMS9SK3BFuZNoLm63byFzS0wbziW/KbPLuZQwJSGQTYIcSZbB46/5w9RH6nML/SUaU Nr/RFd1mxmw1l9i3NkHxgaoLUnpUtfXZs0HRZdiiLnYrTGmLEjFsj6O3pjk5QLb04M1rDh AmvCeAwDBQvrFo28zMT5gEO0GILJBcMVT/pv7PIcNdI7dX+TnuAg5I8HTl5nnA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1643129845; a=rsa-sha256; cv=none; b=JsgCHSZxGa6ae/XJVkX0979HFJqMapKGc1osbXdi5FAks3sApXhHbF5d36OLreGtn9Bmal 38h1fOBWuUo0/AuemYHyU9+LEKlvrNwcwXbIfzFUjT1Ph8e5z4oRfeGLb0TXGblCUtd0Zf 8+1Sfb4gCoaYssbsaow8nxsgF2TtCmejdswyjIIJUlD9uEf0as5hTkupWNOC1KPBv4z9rZ 59HlQlP5hlLh4IYmcc3s1V827CN8cndcAk5dFfhbWYjpu1MKUQNb6LiJBzabCo10Q5r28O UoSIAtP+tCkgXIgLLJtIbjuINtpR7Tr+k4s/FPNqrS7EmE1rEocu2hKiOeHRLw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by wosch: URL: https://cgit.FreeBSD.org/src/commit/?id=ccf50c1df9cf1379e337f695672fecf8331f4706 commit ccf50c1df9cf1379e337f695672fecf8331f4706 Author: Wolfram Schneider AuthorDate: 2022-01-25 16:55:58 +0000 Commit: Wolfram Schneider CommitDate: 2022-01-25 16:55:58 +0000 locate statistics: non zero exit on corrupt database --- usr.bin/locate/locate/fastfind.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/usr.bin/locate/locate/fastfind.c b/usr.bin/locate/locate/fastfind.c index 67d22bfca7b7..7340ce156675 100644 --- a/usr.bin/locate/locate/fastfind.c +++ b/usr.bin/locate/locate/fastfind.c @@ -48,6 +48,7 @@ statistic (fp, path_fcodes) register u_char *p, *s; register int c; int count; + int error = 0; u_char bigram1[NBG], bigram2[NBG], path[MAXPATHLEN]; for (c = 0, p = bigram1, s = bigram2; c < NBG; c++) { @@ -69,6 +70,7 @@ statistic (fp, path_fcodes) if (count < 0 || count > MAXPATHLEN) { /* stop on error and display the statstics anyway */ warnx("corrupted database: %s", path_fcodes); + error = 1; break; } @@ -104,6 +106,9 @@ statistic (fp, path_fcodes) (void)printf("Integers: %ld, ", zwerg); (void)printf("8-Bit characters: %ld\n", umlaut); + /* non zero exit on corrupt database */ + if (error) + exit(error); } #endif /* _LOCATE_STATISTIC_ */