+ std::string tmpdir;
+ strprintf(tmpdir, "%s/apt-dpkg-install-XXXXXX", GetTempDir().c_str());
+ tmpdir_to_free = strndup(tmpdir.data(), tmpdir.length());
+ if (mkdtemp(tmpdir_to_free) == nullptr)
+ return _error->Errno("DPkg::Go", "mkdtemp of %s failed in preparation of calling dpkg unpack", tmpdir_to_free);
+
+ char p = 1;
+ for (auto c = installsToDo - 1; (c = c/10) != 0; ++p);
+ for (unsigned long n = 0; I != J; ++n, ++I)
+ {
+ if (I->File[0] != '/')
+ return _error->Error("Internal Error, Pathname to install is not absolute '%s'",I->File.c_str());
+ auto const file = flNotDir(I->File);
+ std::string linkpath;
+ if (dpkg_recursive_install_numbered)
+ strprintf(linkpath, "%s/%.*lu-%s", tmpdir_to_free, p, n, file.c_str());
+ else
+ strprintf(linkpath, "%s/%s", tmpdir_to_free, file.c_str());
+ if (symlink(I->File.c_str(), linkpath.c_str()) != 0)
+ return _error->Errno("DPkg::Go", "Symlinking %s to %s failed!", I->File.c_str(), linkpath.c_str());
+ }
+ ADDARGC("--recursive");
+ ADDARG(tmpdir_to_free);
+ }
+ else
+ {
+ for (;I != J && Size < MaxArgBytes; ++I)
+ {
+ if (I->File[0] != '/')
+ return _error->Error("Internal Error, Pathname to install is not absolute '%s'",I->File.c_str());
+ Args.push_back(I->File.c_str());
+ Size += I->File.length();
+ }