mergerfs/src/fs_fchmodat.hpp

50 lines
1.3 KiB
C++
Raw Normal View History

2016-10-19 21:28:06 +08:00
/*
ISC License
2020-08-18 04:29:22 +08:00
Copyright (c) 2020, Antonio SJ Musumeci <trapexit@spawn.link>
2016-10-19 21:28:06 +08:00
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
2017-06-30 23:15:20 +08:00
#pragma once
2016-12-23 11:46:20 +08:00
2016-10-19 21:28:06 +08:00
#include <string>
#include <fcntl.h>
#include <sys/stat.h>
namespace fs
{
static
inline
int
2020-08-18 04:29:22 +08:00
fchmodat(const int dirfd_,
const char *pathname_,
const mode_t mode_,
const int flags_)
2016-10-19 21:28:06 +08:00
{
2020-08-18 04:29:22 +08:00
return ::fchmodat(dirfd_,pathname_,mode_,flags_);
2016-10-19 21:28:06 +08:00
}
static
inline
int
2020-08-18 04:29:22 +08:00
fchmodat(const int dirfd_,
const std::string &pathname_,
const mode_t mode_,
const int flags_)
2016-10-19 21:28:06 +08:00
{
2020-08-18 04:29:22 +08:00
return fs::fchmodat(dirfd_,pathname_.c_str(),mode_,flags_);
2016-10-19 21:28:06 +08:00
}
}