[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [util-linux PATCH] Support hwclock for GNU Hurd
From: |
Sergey Bugaev |
Subject: |
Re: [util-linux PATCH] Support hwclock for GNU Hurd |
Date: |
Thu, 5 Dec 2024 16:53:52 +0300 |
On Thu, Dec 5, 2024 at 3:39 PM Zhaoming Luo <zhmingluo@163.com> wrote:
> - rtc_dev_fd = open(rtc_dev_name, O_RDONLY);
> + rtc_dev_fd = open(rtc_dev_name, O_RDONLY | O_WRONLY);
It's called "xxx-only" for a reason :) On standard Unix, you should
use O_RDWR for this.
Now, on the Hurd, these are bitflags: O_RDONLY = O_READ, O_WRONLY =
O_WRITE, O_RDWR = O_READ | O_WRITE. Not so on classic Unix, where
commonly O_RDONLY is 0, O_WRONLY is 1, and O_RDWR is 2.
> } else {
> for (i = 0; i < ARRAY_SIZE(fls); i++) {
> if (ctl->verbose)
> printf(_("Trying to open: %s\n"), fls[i]);
> - rtc_dev_fd = open(fls[i], O_RDONLY);
> + rtc_dev_fd = open(fls[i], O_RDONLY | O_WRONLY);
Ditto.
Sergey