9
0
Fork 0

Fix a case in mq_timedsend() where the return errno value was being overwritten

This commit is contained in:
Gregory Nutt 2015-03-10 12:05:33 -06:00
parent 6201ad6c8e
commit cf749017de
3 changed files with 30 additions and 10 deletions

View File

@ -42,7 +42,6 @@ CONFIG_BUILD_FLAT=y
# Debug Options
#
CONFIG_DEBUG=y
# CONFIG_ARCH_HAVE_STACKCHECK is not set
# CONFIG_ARCH_HAVE_HEAPCHECK is not set
CONFIG_DEBUG_VERBOSE=y
@ -67,6 +66,7 @@ CONFIG_DEBUG_VERBOSE=y
#
# CONFIG_DEBUG_ANALOG is not set
# CONFIG_DEBUG_GPIO is not set
# CONFIG_ARCH_HAVE_STACKCHECK is not set
CONFIG_DEBUG_SYMBOLS=y
# CONFIG_ARCH_HAVE_CUSTOMOPT is not set
CONFIG_DEBUG_NOOPT=y
@ -94,6 +94,7 @@ CONFIG_HOST_X86_64=y
# CONFIG_HOST_X86 is not set
CONFIG_SIM_M32=y
# CONFIG_SIM_WALLTIME is not set
# CONFIG_SIM_FRAMEBUFFER is not set
# CONFIG_SIM_SPIFLASH is not set
#
@ -286,9 +287,9 @@ CONFIG_DEV_NULL=y
# CONFIG_I2C is not set
# CONFIG_SPI is not set
# CONFIG_I2S is not set
# CONFIG_TIMER is not set
# CONFIG_RTC is not set
# CONFIG_WATCHDOG is not set
# CONFIG_TIMER is not set
# CONFIG_ANALOG is not set
# CONFIG_AUDIO_DEVICES is not set
# CONFIG_VIDEO_DEVICES is not set
@ -297,6 +298,7 @@ CONFIG_DEV_NULL=y
# CONFIG_LCD is not set
# CONFIG_MMCSD is not set
# CONFIG_MTD is not set
# CONFIG_EEPROM is not set
# CONFIG_PIPES is not set
# CONFIG_PM is not set
# CONFIG_POWER is not set
@ -333,9 +335,9 @@ CONFIG_SERIAL=y
#
# CONFIG_MCU_SERIAL is not set
# CONFIG_STANDARD_SERIAL is not set
# CONFIG_ARCH_HAVE_SERIAL_TERMIOS is not set
# CONFIG_SERIAL_IFLOWCONTROL is not set
# CONFIG_SERIAL_OFLOWCONTROL is not set
# CONFIG_ARCH_HAVE_SERIAL_TERMIOS is not set
# CONFIG_USBDEV is not set
# CONFIG_USBHOST is not set
# CONFIG_WIRELESS is not set
@ -348,6 +350,7 @@ CONFIG_SERIAL=y
# System Logging
#
# CONFIG_RAMLOG is not set
# CONFIG_SYSLOG_CONSOLE is not set
#
# Networking Support
@ -432,6 +435,7 @@ CONFIG_LIB_HOMEDIR="/"
# CONFIG_LIBM is not set
# CONFIG_NOPRINTF_FIELDWIDTH is not set
# CONFIG_LIBC_FLOATINGPOINT is not set
# CONFIG_LIBC_IOCTL_VARIADIC is not set
CONFIG_LIB_RAND_ORDER=1
# CONFIG_EOL_IS_CR is not set
# CONFIG_EOL_IS_LF is not set
@ -522,7 +526,6 @@ CONFIG_EXAMPLES_OSTEST_RR_RUNS=10
# CONFIG_EXAMPLES_THTTPD is not set
# CONFIG_EXAMPLES_TIFF is not set
# CONFIG_EXAMPLES_TOUCHSCREEN is not set
# CONFIG_EXAMPLES_UDP is not set
# CONFIG_EXAMPLES_WEBSERVER is not set
# CONFIG_EXAMPLES_USBSERIAL is not set
# CONFIG_EXAMPLES_USBTERM is not set
@ -532,12 +535,14 @@ CONFIG_EXAMPLES_OSTEST_RR_RUNS=10
# Graphics Support
#
# CONFIG_TIFF is not set
# CONFIG_GRAPHICS_TRAVELER is not set
#
# Interpreters
#
# CONFIG_INTERPRETERS_FICL is not set
# CONFIG_INTERPRETERS_PCODE is not set
# CONFIG_INTERPRETERS_MICROPYTHON is not set
#
# Network Utilities
@ -547,9 +552,7 @@ CONFIG_EXAMPLES_OSTEST_RR_RUNS=10
# Networking Utilities
#
# CONFIG_NETUTILS_CODECS is not set
# CONFIG_NETUTILS_DHCPD is not set
# CONFIG_NETUTILS_FTPC is not set
# CONFIG_NETUTILS_FTPD is not set
# CONFIG_NETUTILS_JSON is not set
# CONFIG_NETUTILS_SMTP is not set
# CONFIG_NETUTILS_TFTPC is not set
@ -590,6 +593,11 @@ CONFIG_EXAMPLES_OSTEST_RR_RUNS=10
#
# CONFIG_SYSTEM_CLE is not set
#
# CU Minimal Terminal
#
# CONFIG_SYSTEM_CUTERM is not set
#
# FLASH Program Installation
#
@ -616,7 +624,6 @@ CONFIG_EXAMPLES_OSTEST_RR_RUNS=10
#
# NxPlayer media player library / command Line
#
# CONFIG_SYSTEM_NXPLAYER is not set
#
# RAM test
@ -661,6 +668,10 @@ CONFIG_EXAMPLES_OSTEST_RR_RUNS=10
#
# CONFIG_SYSTEM_SYSINFO is not set
#
# Temperature
#
#
# VI Work-Alike Editor
#

View File

@ -298,6 +298,7 @@ int mq_waitsend(mqd_t mqdes)
}
}
}
return OK;
}

View File

@ -199,6 +199,8 @@ int mq_timedsend(mqd_t mqdes, FAR const char *msg, size_t msglen, int prio,
if (mq_verifysend(mqdes, msg, msglen, prio) != OK)
{
/* mq_verifysend() will set the errno appropriately */
return ERROR;
}
@ -234,7 +236,9 @@ int mq_timedsend(mqd_t mqdes, FAR const char *msg, size_t msglen, int prio,
if (msgq->nmsgs < msgq->maxmsgs || up_interrupt_context())
{
/* Do the send with no further checks (possibly exceeding maxmsgs) */
/* Do the send with no further checks (possibly exceeding maxmsgs)
* Currently mq_dosend() always returns OK.
*/
ret = mq_dosend(mqdes, mqmsg, msg, msglen, prio);
sched_unlock();
@ -280,7 +284,6 @@ int mq_timedsend(mqd_t mqdes, FAR const char *msg, size_t msglen, int prio,
if (result == OK && ticks <= 0)
{
result = ETIMEDOUT;
goto errout_with_irqsave;
}
/* Handle any time-related errors */
@ -304,10 +307,13 @@ int mq_timedsend(mqd_t mqdes, FAR const char *msg, size_t msglen, int prio,
wd_cancel(rtcb->waitdog);
/* Check if the wait failed */
/* Check if mq_waitsend() failed */
if (ret < 0)
{
/* mq_waitsend() will set the errno, but the error exit will reset it */
result = get_errno();
goto errout_with_irqsave;
}
@ -318,6 +324,8 @@ int mq_timedsend(mqd_t mqdes, FAR const char *msg, size_t msglen, int prio,
/* If any of the above failed, set the errno. Otherwise, there should
* be space for another message in the message queue. NOW we can allocate
* the message structure.
*
* Currently mq_dosend() always returns OK.
*/
ret = mq_dosend(mqdes, mqmsg, msg, msglen, prio);