diff --git a/src/libstore/daemon.cc b/src/libstore/daemon.cc index 6079eae7b..9002a89bc 100644 --- a/src/libstore/daemon.cc +++ b/src/libstore/daemon.cc @@ -1025,6 +1025,7 @@ void processConnection( { #ifndef _WIN32 // TODO need graceful async exit support on Windows? auto monitor = !recursive ? std::make_unique(from.fd) : nullptr; + (void) monitor; // suppress warning #endif /* Exchange the greeting. */ diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc index b4a023928..c6e3af456 100644 --- a/src/libstore/local-store.cc +++ b/src/libstore/local-store.cc @@ -345,7 +345,7 @@ LocalStore::LocalStore( else if (curSchema == 0) { /* new store */ curSchema = nixSchemaVersion; openDB(*state, true); - writeFile(schemaPath, fmt("%1%", nixSchemaVersion), 0666, true); + writeFile(schemaPath, fmt("%1%", curSchema), 0666, true); } else if (curSchema < nixSchemaVersion) { diff --git a/src/libutil/git.cc b/src/libutil/git.cc index af91fa643..7a9ac0bd8 100644 --- a/src/libutil/git.cc +++ b/src/libutil/git.cc @@ -33,7 +33,7 @@ std::optional decodeMode(RawMode m) { static std::string getStringUntil(Source & source, char byte) { std::string s; - char n[1]; + char n[1] = { 0 }; source(std::string_view { n, 1 }); while (*n != byte) { s += *n; diff --git a/tests/nixos/ca-fd-leak/sender.c b/tests/nixos/ca-fd-leak/sender.c index 75e54fc8f..44d13c990 100644 --- a/tests/nixos/ca-fd-leak/sender.c +++ b/tests/nixos/ca-fd-leak/sender.c @@ -19,7 +19,7 @@ int main(int argc, char **argv) { struct sockaddr_un data; data.sun_family = AF_UNIX; data.sun_path[0] = 0; - strcpy(data.sun_path + 1, argv[1]); + strncpy(data.sun_path + 1, argv[1], sizeof(data.sun_path) - 2); // Now try to connect, To ensure we work no matter what order we are // executed in, just busyloop here. diff --git a/tests/nixos/ca-fd-leak/smuggler.c b/tests/nixos/ca-fd-leak/smuggler.c index 82acf37e6..ae6bd5371 100644 --- a/tests/nixos/ca-fd-leak/smuggler.c +++ b/tests/nixos/ca-fd-leak/smuggler.c @@ -5,6 +5,7 @@ #include #include #include +#include int main(int argc, char **argv) {