diff options
-rw-r--r-- | cmd/zed/zed_conf.c | 2 | ||||
-rw-r--r-- | cmd/zed/zed_file.c | 27 | ||||
-rw-r--r-- | cmd/zed/zed_file.h | 2 |
3 files changed, 1 insertions, 30 deletions
diff --git a/cmd/zed/zed_conf.c b/cmd/zed/zed_conf.c index f11d8b398..1dbbb3b65 100644 --- a/cmd/zed/zed_conf.c +++ b/cmd/zed/zed_conf.c @@ -515,7 +515,7 @@ zed_conf_write_pid(struct zed_conf *zcp) errno = ERANGE; zed_log_msg(LOG_ERR, "Failed to write PID file \"%s\": %s", zcp->pid_file, strerror(errno)); - } else if (zed_file_write_n(zcp->pid_fd, buf, n) != n) { + } else if (write(zcp->pid_fd, buf, n) != n) { zed_log_msg(LOG_ERR, "Failed to write PID file \"%s\": %s", zcp->pid_file, strerror(errno)); } else if (fdatasync(zcp->pid_fd) < 0) { diff --git a/cmd/zed/zed_file.c b/cmd/zed/zed_file.c index aeaa7a014..401ab89eb 100644 --- a/cmd/zed/zed_file.c +++ b/cmd/zed/zed_file.c @@ -25,33 +25,6 @@ #include "zed_log.h" /* - * Write [n] bytes from [buf] out to [fd]. - * Return the number of bytes written, or -1 on error. - */ -ssize_t -zed_file_write_n(int fd, void *buf, size_t n) -{ - const unsigned char *p; - size_t n_left; - ssize_t n_written; - - p = buf; - n_left = n; - while (n_left > 0) { - if ((n_written = write(fd, p, n_left)) < 0) { - if (errno == EINTR) - continue; - else - return (-1); - - } - n_left -= n_written; - p += n_written; - } - return (n); -} - -/* * Set an exclusive advisory lock on the open file descriptor [fd]. * Return 0 on success, 1 if a conflicting lock is held by another process, * or -1 on error (with errno set). diff --git a/cmd/zed/zed_file.h b/cmd/zed/zed_file.h index 28473a545..5cb5e8804 100644 --- a/cmd/zed/zed_file.h +++ b/cmd/zed/zed_file.h @@ -18,8 +18,6 @@ #include <sys/types.h> #include <unistd.h> -ssize_t zed_file_write_n(int fd, void *buf, size_t n); - int zed_file_lock(int fd); int zed_file_unlock(int fd); |