aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSid Nayyar <sidnayyar@google.com>2024-02-20 14:54:43 +0000
committerGiuliano Procida <gprocida@google.com>2024-03-08 14:23:37 +0000
commitd9a9f9d6e1dbabdf0858c10ffed9577eda1e160a (patch)
tree80a7782a566b7aebfb90443a0bf17205eb1fe5e0
parente74501fa70d2ccfa206a8faf38b157eed5f93465 (diff)
downloadstg-d9a9f9d6e1dbabdf0858c10ffed9577eda1e160a.tar.gz
proto writer: fix created file permissions
Following the change to use protobuf zero copy output streams, files were being created with no group or other permissions, regardless of umask. We now pass `0666` to `open(2)`. PiperOrigin-RevId: 608588716 Change-Id: I92d5bdf98966e063f698ba09d4fd8b3ee258e3f2
-rw-r--r--stg.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/stg.cc b/stg.cc
index 8c97a6b..c046c3b 100644
--- a/stg.cc
+++ b/stg.cc
@@ -101,9 +101,10 @@ void FilterSymbols(Graph& graph, Id root, const Filter& filter) {
}
void Write(Runtime& runtime, const Graph& graph, Id root, const char* output) {
- FileDescriptor output_file_descriptor(output, O_CREAT | O_WRONLY | O_TRUNC,
- S_IRUSR | S_IWUSR);
- google::protobuf::io::FileOutputStream os(output_file_descriptor.Value());
+ const FileDescriptor output_fd(
+ output, O_CREAT | O_WRONLY | O_TRUNC,
+ S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
+ google::protobuf::io::FileOutputStream os(output_fd.Value());
{
const Time x(runtime, "write");
proto::Writer writer(graph);