Skip to content

Commit 4de73df

Browse files
authored
Merge pull request #12765 from Mic92/clan-tidy-cleanups
Add various clang tidy fixes
2 parents cfc4db8 + 5c3682d commit 4de73df

File tree

5 files changed

+5
-3
lines changed

5 files changed

+5
-3
lines changed

src/libstore/daemon.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,6 +1025,7 @@ void processConnection(
10251025
{
10261026
#ifndef _WIN32 // TODO need graceful async exit support on Windows?
10271027
auto monitor = !recursive ? std::make_unique<MonitorFdHup>(from.fd) : nullptr;
1028+
(void) monitor; // suppress warning
10281029
#endif
10291030

10301031
/* Exchange the greeting. */

src/libstore/local-store.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ LocalStore::LocalStore(
245245
else if (curSchema == 0) { /* new store */
246246
curSchema = nixSchemaVersion;
247247
openDB(*state, true);
248-
writeFile(schemaPath, fmt("%1%", nixSchemaVersion), 0666, true);
248+
writeFile(schemaPath, fmt("%1%", curSchema), 0666, true);
249249
}
250250

251251
else if (curSchema < nixSchemaVersion) {

src/libutil/git.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ std::optional<Mode> decodeMode(RawMode m) {
3333
static std::string getStringUntil(Source & source, char byte)
3434
{
3535
std::string s;
36-
char n[1];
36+
char n[1] = { 0 };
3737
source(std::string_view { n, 1 });
3838
while (*n != byte) {
3939
s += *n;

tests/nixos/ca-fd-leak/sender.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ int main(int argc, char **argv) {
1919
struct sockaddr_un data;
2020
data.sun_family = AF_UNIX;
2121
data.sun_path[0] = 0;
22-
strcpy(data.sun_path + 1, argv[1]);
22+
strncpy(data.sun_path + 1, argv[1], sizeof(data.sun_path) - 2);
2323

2424
// Now try to connect, To ensure we work no matter what order we are
2525
// executed in, just busyloop here.

tests/nixos/ca-fd-leak/smuggler.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <stdio.h>
66
#include <unistd.h>
77
#include <assert.h>
8+
#include <string.h>
89

910
int main(int argc, char **argv) {
1011

0 commit comments

Comments
 (0)