xref: /aosp_15_r20/external/libbrillo/brillo/scoped_umask.cc (revision 1a96fba65179ea7d3f56207137718607415c5953)
1 // Copyright 2019 The Chromium OS Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "brillo/scoped_umask.h"
6 
7 #include <sys/stat.h>
8 
9 namespace brillo {
10 
ScopedUmask(mode_t new_umask)11 ScopedUmask::ScopedUmask(mode_t new_umask) {
12   saved_umask_ = umask(new_umask);
13 }
14 
~ScopedUmask()15 ScopedUmask::~ScopedUmask() {
16   umask(saved_umask_);
17 }
18 
19 }  // namespace brillo
20