From 7fff9a000ae99030a35b5e512c99c7ac3569538e Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 1 Jun 2016 15:45:56 -0600 Subject: [PATCH 1/2] Prep for NuttX-7.16 release --- ChangeLog.txt | 3 ++- examples/alarm/alarm_main.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 908755512..3c3ba70fd 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1574,7 +1574,7 @@ USB device interfaces that do not yet have boardctl() commands (2016-03-25). -7.16 2016-xx-xx Gregory Nutt +7.16 2016-06-01 Gregory Nutt * apps/system/sdcard: Remove the SD card application. This application violates OS/application interface rules and has been @@ -1605,3 +1605,4 @@ path by providing an alternal path on the command line. From Sébastien Lorquet (2016-06-01). +7.17 2016-xx-xx Gregory Nutt diff --git a/examples/alarm/alarm_main.c b/examples/alarm/alarm_main.c index 582cfe04b..7bfb4870b 100644 --- a/examples/alarm/alarm_main.c +++ b/examples/alarm/alarm_main.c @@ -307,7 +307,7 @@ int alarm_main(int argc, FAR char *argv[]) return EXIT_FAILURE; } - printf("Alarm set in %lu seconds\n", seconds); + printf("Alarm %d set in %lu seconds\n", alarmid, seconds); (void)close(fd); return EXIT_SUCCESS; } From 59973da9cafd6a57bec5bd6fae267859e6b622a6 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 2 Jun 2016 06:58:45 -0600 Subject: [PATCH 2/2] apps/examples/alarm: ioctl call was clobbering file descriptor. --- examples/alarm/alarm_main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/examples/alarm/alarm_main.c b/examples/alarm/alarm_main.c index 7bfb4870b..9a2626c30 100644 --- a/examples/alarm/alarm_main.c +++ b/examples/alarm/alarm_main.c @@ -279,6 +279,7 @@ int alarm_main(int argc, FAR char *argv[]) /* Open the RTC driver */ printf("Opening %s\n", CONFIG_EXAMPLES_ALARM_DEVPATH); + fd = open(CONFIG_EXAMPLES_ALARM_DEVPATH, O_WRONLY); if (fd < 0) { @@ -297,17 +298,20 @@ int alarm_main(int argc, FAR char *argv[]) setrel.sigvalue.sival_int = alarmid; - fd = ioctl(fd, RTC_SET_RELATIVE, (unsigned long)((uintptr_t)&setrel)); - if (fd < 0) + ret = ioctl(fd, RTC_SET_RELATIVE, (unsigned long)((uintptr_t)&setrel)); + if (ret < 0) { int errcode = errno; + fprintf(stderr, "ERROR: RTC_SET_RELATIVE ioctl failed: %d\n", errcode); + (void)close(fd); return EXIT_FAILURE; } printf("Alarm %d set in %lu seconds\n", alarmid, seconds); + (void)close(fd); return EXIT_SUCCESS; }