diff options
Diffstat (limited to 'third_party/nix/src/libstore/local-store.cc')
-rw-r--r-- | third_party/nix/src/libstore/local-store.cc | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/third_party/nix/src/libstore/local-store.cc b/third_party/nix/src/libstore/local-store.cc index 14ba580654ab..3ad574186bf7 100644 --- a/third_party/nix/src/libstore/local-store.cc +++ b/third_party/nix/src/libstore/local-store.cc @@ -89,7 +89,7 @@ LocalStore::LocalStore(const Params& params) LOG(ERROR) << "warning: the group '" << settings.buildUsersGroup << "' specified in 'build-users-group' does not exist"; } else { - struct stat st {}; + struct stat st; if (stat(realStoreDir.c_str(), &st) != 0) { throw SysError(format("getting attributes of path '%1%'") % realStoreDir); @@ -112,7 +112,7 @@ LocalStore::LocalStore(const Params& params) /* Ensure that the store and its parents are not symlinks. */ if (getEnv("NIX_IGNORE_SYMLINK_STORE") != "1") { Path path = realStoreDir; - struct stat st {}; + struct stat st; while (path != "/") { if (lstat(path.c_str(), &st) != 0) { throw SysError(format("getting status of '%1%'") % path); @@ -132,7 +132,7 @@ LocalStore::LocalStore(const Params& params) needed, we reserve some dummy space that we can free just before doing a garbage collection. */ try { - struct stat st {}; + struct stat st; if (stat(reservedPath.c_str(), &st) == -1 || st.st_size != settings.reservedSize) { AutoCloseFD fd = @@ -350,8 +350,7 @@ void LocalStore::openDB(State& state, bool create) { if (sqlite3_step(stmt) != SQLITE_ROW) { throwSQLiteError(db, "querying journal mode"); } - prevMode = std::string( - reinterpret_cast<const char*>(sqlite3_column_text(stmt, 0))); + prevMode = std::string((const char*)sqlite3_column_text(stmt, 0)); } if (prevMode != mode && sqlite3_exec(db, ("pragma main.journal_mode = " + mode + ";").c_str(), @@ -380,7 +379,7 @@ void LocalStore::makeStoreWritable() { return; } /* Check if /nix/store is on a read-only mount. */ - struct statvfs stat {}; + struct statvfs stat; if (statvfs(realStoreDir.c_str(), &stat) != 0) { throw SysError("getting info about the Nix store mount point"); } @@ -434,7 +433,7 @@ static void canonicaliseTimestampAndPermissions(const Path& path, } // namespace nix void canonicaliseTimestampAndPermissions(const Path& path) { - struct stat st {}; + struct stat st; if (lstat(path.c_str(), &st) != 0) { throw SysError(format("getting attributes of path '%1%'") % path); } @@ -445,7 +444,7 @@ static void canonicalisePathMetaData_(const Path& path, uid_t fromUid, InodesSeen& inodesSeen) { checkInterrupt(); - struct stat st {}; + struct stat st; if (lstat(path.c_str(), &st) != 0) { throw SysError(format("getting attributes of path '%1%'") % path); } @@ -490,7 +489,7 @@ static void canonicalisePathMetaData_(const Path& path, uid_t fromUid, However, ignore files that we chown'ed ourselves previously to ensure that we don't fail on hard links within the same build (i.e. "touch $out/foo; ln $out/foo $out/bar"). */ - if (fromUid != static_cast<uid_t>(-1) && st.st_uid != fromUid) { + if (fromUid != (uid_t)-1 && st.st_uid != fromUid) { if (S_ISDIR(st.st_mode)) { throw BuildError(format("invalid file '%1%': is a directory") % path); } @@ -545,7 +544,7 @@ void canonicalisePathMetaData(const Path& path, uid_t fromUid, /* On platforms that don't have lchown(), the top-level path can't be a symlink, since we can't change its ownership. */ - struct stat st {}; + struct stat st; if (lstat(path.c_str(), &st) != 0) { throw SysError(format("getting attributes of path '%1%'") % path); } @@ -575,7 +574,7 @@ void LocalStore::checkDerivationOutputs(const Path& drvPath, drvPath); } - bool recursive = 0; + bool recursive; Hash h; out->second.parseHashInfo(recursive, h); Path outPath = makeFixedOutputPath(recursive, h, drvName); @@ -691,8 +690,7 @@ void LocalStore::queryPathInfoUncached( info->registrationTime = useQueryPathInfo.getInt(2); - auto s = reinterpret_cast<const char*>( - sqlite3_column_text(state->stmtQueryPathInfo, 3)); + auto s = (const char*)sqlite3_column_text(state->stmtQueryPathInfo, 3); if (s != nullptr) { info->deriver = s; } @@ -702,14 +700,12 @@ void LocalStore::queryPathInfoUncached( info->ultimate = useQueryPathInfo.getInt(5) == 1; - s = reinterpret_cast<const char*>( - sqlite3_column_text(state->stmtQueryPathInfo, 6)); + s = (const char*)sqlite3_column_text(state->stmtQueryPathInfo, 6); if (s != nullptr) { info->sigs = absl::StrSplit(s, absl::ByChar(' ')); } - s = reinterpret_cast<const char*>( - sqlite3_column_text(state->stmtQueryPathInfo, 7)); + s = (const char*)sqlite3_column_text(state->stmtQueryPathInfo, 7); if (s != nullptr) { info->ca = s; } @@ -864,8 +860,8 @@ Path LocalStore::queryPathFromHashPart(const std::string& hashPart) { return ""; } - const char* s = reinterpret_cast<const char*>( - sqlite3_column_text(state->stmtQueryPathFromHashPart, 0)); + const char* s = + (const char*)sqlite3_column_text(state->stmtQueryPathFromHashPart, 0); return (s != nullptr) && prefix.compare(0, prefix.size(), s, prefix.size()) == 0 ? s |