many rtc drivers don't implement the RTC_AIE_ON/OFF ioctls at all --
so if we never tried to enable the alarm interrupt, don't try to
disable it later.
Signed-off-by: Paul Fox <pgf@laptop.org>
static unsigned verbose;
static unsigned dryrun;
+static unsigned ioctl_aie_on; // ioctl(AIE_ON) succeeded
enum ClockMode clock_mode = CM_AUTO;
static struct option long_options[] = {
warn(_("enable rtc alarm failed"));
return -1;
}
+ ioctl_aie_on = 1;
} else {
warn(_("set rtc wake alarm failed"));
return -1;
suspend_system(suspend);
}
- if (!dryrun && ioctl(fd, RTC_AIE_OFF, 0) < 0)
+ if (!dryrun && ioctl_aie_on && ioctl(fd, RTC_AIE_OFF, 0) < 0)
+
warn(_("disable rtc alarm interrupt failed"));
close(fd);