[PATCH] D93881: [llvm-objcopy] preserve file ownership when overwritten

Manoj Gupta via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 2 20:50:00 PST 2021


manojgupta added inline comments.


================
Comment at: llvm/lib/Support/FileOutputBuffer.cpp:142
+    if (!EC)
+      fs::changeFileOwnership(File.TmpName, Stat.getUser(), Stat.getGroup());
+  }
----------------
Can we pass the file descriptor (File.FD) directly?


================
Comment at: llvm/lib/Support/Unix/Path.inc:1216
+                                    uint32_t Group) {
+  int FD;
+  if (std::error_code EC =
----------------
Please use the existing file descriptor and call fchown. I don't think there is any need to open and close the file if file is already open.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93881/new/

https://reviews.llvm.org/D93881



More information about the llvm-commits mailing list