#ifdef O_CLOEXEC
oflags |= O_CLOEXEC;
#endif
+
+ if (fname == nullptr) {
+ return tl::make_unexpected("cannot open file; filename is nullptr");
+ }
+
auto fd = ::open(fname, oflags);
if (fd == -1) {
#ifdef O_CLOEXEC
oflags |= O_CLOEXEC | O_CREAT | O_EXCL;
#endif
+
+ if (fname == nullptr) {
+ return tl::make_unexpected("cannot open file; filename is nullptr");
+ }
+
auto fd = ::open(fname, oflags, perms);
if (fd == -1) {
#ifdef O_CLOEXEC
oflags |= O_CLOEXEC | O_CREAT | O_EXCL;
#endif
+ if (fname == nullptr) {
+ return tl::make_unexpected("cannot open file; filename is nullptr");
+ }
+
auto fd = ::open(fname, oflags, perms);
if (fd == -1) {