From 68c4dedb789d92b2c84f9d6ca3f49a59686cc585 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 23 Oct 2015 07:09:25 +0800 Subject: [PATCH] Named semaphores: Bad cast in sem_close(). Fixed by reordering fields of struct nsem_inode_s so that the cast will work --- include/nuttx/semaphore.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/nuttx/semaphore.h b/include/nuttx/semaphore.h index 5460ce15c5..2eb624bf70 100644 --- a/include/nuttx/semaphore.h +++ b/include/nuttx/semaphore.h @@ -60,10 +60,12 @@ struct inode; struct nsem_inode_s { - /* Inode payload unique to named semaphores */ + /* Inode payload unique to named semaphores. ns_sem must appear first in + * this structure in order to support casting between type sem_t and + * types of struct nsem_inode_s. */ - FAR struct inode *ns_inode; /* Containing inode */ sem_t ns_sem; /* The semaphore */ + FAR struct inode *ns_inode; /* Containing inode */ }; #endif