[llvm] r184630 - Create the file with the right permissions instead of setting it afterwards.

罗勇刚(Yonggang Luo) luoyonggang at gmail.com
Fri Jun 21 19:39:24 PDT 2013


Is that 0666 are a bit magic?
and portable across different platform?

2013/6/22 Rafael Espindola <rafael.espindola at gmail.com>:
> Author: rafael
> Date: Fri Jun 21 21:34:24 2013
> New Revision: 184630
>
> URL: http://llvm.org/viewvc/llvm-project?rev=184630&view=rev
> Log:
> Create the file with the right permissions instead of setting it afterwards.
>
> Removes the last use of PathV1.h in llvm-ar.
>
> Modified:
>     llvm/trunk/tools/llvm-ar/ArchiveWriter.cpp
>
> Modified: llvm/trunk/tools/llvm-ar/ArchiveWriter.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-ar/ArchiveWriter.cpp?rev=184630&r1=184629&r2=184630&view=diff
> ==============================================================================
> --- llvm/trunk/tools/llvm-ar/ArchiveWriter.cpp (original)
> +++ llvm/trunk/tools/llvm-ar/ArchiveWriter.cpp Fri Jun 21 21:34:24 2013
> @@ -18,7 +18,6 @@
>  #include "llvm/IR/Module.h"
>  #include "llvm/Support/FileSystem.h"
>  #include "llvm/Support/MemoryBuffer.h"
> -#include "llvm/Support/PathV1.h"
>  #include "llvm/Support/Process.h"
>  #include "llvm/Support/Signals.h"
>  #include "llvm/Support/system_error.h"
> @@ -269,7 +268,7 @@ bool Archive::writeToDisk(bool TruncateN
>    int TmpArchiveFD;
>    SmallString<128> TmpArchive;
>    error_code EC = sys::fs::unique_file("temp-archive-%%%%%%%.a", TmpArchiveFD,
> -                                       TmpArchive);
> +                                       TmpArchive, true, 0666);
>    if (EC)
>      return true;
>
> @@ -305,12 +304,5 @@ bool Archive::writeToDisk(bool TruncateN
>      return true;
>    }
>
> -  // Set correct read and write permissions after temporary file is moved
> -  // to final destination path.
> -  if (sys::Path(archPath).makeReadableOnDisk(ErrMsg))
> -    return true;
> -  if (sys::Path(archPath).makeWriteableOnDisk(ErrMsg))
> -    return true;
> -
>    return false;
>  }
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits



-- 
         此致
礼
罗勇刚
Yours
    sincerely,
Yonggang Luo




More information about the llvm-commits mailing list