shakaran

apt-pkg mkstemp change

Aug 21st, 2013
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 0.74 KB | None | 0 0
  1. diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc
  2. index dca468c..b5da4bf 100644
  3. --- a/apt-pkg/contrib/fileutl.cc
  4. +++ b/apt-pkg/contrib/fileutl.cc
  5. @@ -947,7 +947,11 @@ bool FileFd::Open(string FileName,unsigned int const Mode,APT::Configuration::Co
  6.     {
  7.        Flags |= Replace;
  8.        char *name = strdup((FileName + ".XXXXXX").c_str());
  9. -      TemporaryFileName = string(mktemp(name));
  10. +      if((iFd = mkstemp(name)) == -1)
  11. +      {
  12. +          return FileFdError("Could not create temporary file %s", name);
  13. +      }
  14. +      TemporaryFileName = string(mktemp(name)); // Remove this and use file descriptor instead of filename
  15.        free(name);
  16.     }
  17.     else if ((Mode & (Exclusive | Create)) == (Exclusive | Create))
Advertisement
Add Comment
Please, Sign In to add comment