Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
sekiguchi-nagisa committed May 21, 2024
1 parent 4be284d commit 5446721
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class Logger : public SingletonLogger<Logger> {
unsigned int whiteList{0};

public:
enum Policy : unsigned int {
enum Policy : unsigned char {
#define GEN_ENUM(E) E,
EACH_LOGGING_POLICY(GEN_ENUM)
#undef GEN_ENUM
Expand Down
2 changes: 1 addition & 1 deletion src/object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ uint32_t Value::getMetaData() const {
union { // NOLINT
char i8[4];
uint32_t u32;
} conv;
} conv = {};
memcpy(conv.i8, this->str.value + 11, 4);
return conv.u32;
}
Expand Down
8 changes: 3 additions & 5 deletions tools/process/process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,6 @@ static void openPTY(const IOConfig &config, int &masterFD, int &slaveFD) {
}
}

static void setCLOEXEC(int fd) { fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC); }

class StreamBuilder {
private:
const IOConfig config;
Expand Down Expand Up @@ -335,9 +333,9 @@ class StreamBuilder {
close(this->masterFD);
}

setCLOEXEC(this->inputWriter());
setCLOEXEC(this->outputReader());
setCLOEXEC(this->errorReader());
arsh::setCloseOnExec(this->inputWriter(), true);
arsh::setCloseOnExec(this->outputReader(), true);
arsh::setCloseOnExec(this->errorReader(), true);
}

int findPTY() const {
Expand Down

0 comments on commit 5446721

Please sign in to comment.