On 12/5/24 9:53 PM, Sergey Bugaev wrote:
On Thu, Dec 5, 2024 at 3:39 PM Zhaoming Luo <zhming...@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.

Thanks for the review. I have corrected it in the new patch.

--
Zhaoming Luo


Reply via email to