diff --git a/src/utils/pathut.cpp b/src/utils/pathut.cpp index 4e21e6e7..38d77f4d 100644 --- a/src/utils/pathut.cpp +++ b/src/utils/pathut.cpp @@ -1096,24 +1096,24 @@ Pidfile::~Pidfile() this->close(); } -pid_t Pidfile::read_pid() +int Pidfile::read_pid() { int fd = ::open(m_path.c_str(), O_RDONLY); if (fd == -1) { - return (pid_t) -1; + return -1; } char buf[16]; int i = read(fd, buf, sizeof(buf) - 1); ::close(fd); if (i <= 0) { - return (pid_t) -1; + return -1; } buf[i] = '\0'; char *endptr; - pid_t pid = strtol(buf, &endptr, 10); + int pid = strtol(buf, &endptr, 10); if (endptr != &buf[i]) { - return (pid_t) - 1; + return - 1; } return pid; } @@ -1161,12 +1161,12 @@ int Pidfile::flopen() return 0; } -pid_t Pidfile::open() +int Pidfile::open() { if (flopen() < 0) { return read_pid(); } - return (pid_t)0; + return 0; } int Pidfile::write_pid() diff --git a/src/utils/pathut.h b/src/utils/pathut.h index 91b48e40..a31e06fa 100644 --- a/src/utils/pathut.h +++ b/src/utils/pathut.h @@ -175,7 +175,7 @@ public: ~Pidfile(); /// Open/create the pid file. /// @return 0 if ok, > 0 for pid of existing process, -1 for other error. - pid_t open(); + int open(); /// Write pid into the pid file /// @return 0 ok, -1 error int write_pid(); @@ -190,7 +190,7 @@ private: std::string m_path; int m_fd; std::string m_reason; - pid_t read_pid(); + int read_pid(); int flopen(); };