diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-04-16 01:04:17 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-04-16 01:04:17 +0000 |
commit | 4264cfb4e8ab918f350dc625019b8492cc8d9e40 (patch) | |
tree | f6c80ca59449872801c0050b6cdb5bf3ed27299b | |
parent | f59a457ba7da70e76fdba829f1b17764dbc1d486 (diff) | |
download | nuttx-4264cfb4e8ab918f350dc625019b8492cc8d9e40.tar.gz nuttx-4264cfb4e8ab918f350dc625019b8492cc8d9e40.tar.bz2 nuttx-4264cfb4e8ab918f350dc625019b8492cc8d9e40.zip |
Fix bad conditional compilation that breaks THTTPD and dup2()
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3511 42af7a65-404d-4744-a932-0658087f49c3
-rw-r--r-- | nuttx/ChangeLog | 7 | ||||
-rw-r--r-- | nuttx/Documentation/NuttX.html | 10 | ||||
-rw-r--r-- | nuttx/fs/fs_dup2.c | 5 | ||||
-rw-r--r-- | nuttx/fs/fs_filedup.c | 5 | ||||
-rw-r--r-- | nuttx/fs/fs_filedup2.c | 7 | ||||
-rw-r--r-- | nuttx/include/nuttx/net.h | 2 | ||||
-rw-r--r-- | nuttx/net/net_dup2.c | 4 |
7 files changed, 25 insertions, 15 deletions
diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 7760d52ea..adf146a4b 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -1695,6 +1695,7 @@ file * sched/clock_uptime() and lib/time/lib_time.c: Add support for 1 second uptime interface. - - - + * net/net_dup2.c and include/nuttx/net.h: The conditional compilation for + '#if CONFIG_NFILE_DESCRIPTOR > 0' was wrong in both of these files. It should + be '#if CONFIG_NFILE_DESCRIPTORS > 0'. This causes a dup2() failure in THTTPD + and a failure to get a CGI page. The consequence can be a very serious bug! diff --git a/nuttx/Documentation/NuttX.html b/nuttx/Documentation/NuttX.html index f3efc72f8..e655bb9af 100644 --- a/nuttx/Documentation/NuttX.html +++ b/nuttx/Documentation/NuttX.html @@ -8,7 +8,7 @@ <tr align="center" bgcolor="#e4e4e4"> <td> <h1><big><font color="#3c34ec"><i>NuttX RTOS</i></font></big></h1> - <p>Last Updated: April 14, 2011</p> + <p>Last Updated: April 15, 2011</p> </td> </tr> </table> @@ -2222,10 +2222,16 @@ nuttx-6.2 2011-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr> UART2 and UART3. * nuttx/clock.h: Replace all references to the global variable g_system_timer with clock_systemtimer() (currently just a macro that that returns g_system_timer). -= * lib/string/strrch.c: Would fail if the searched-for character were the first + * lib/string/strrch.c: Would fail if the searched-for character were the first character in the string. * tools/version.sh and mkversion.c: Tools to manage a NuttX version number file + * sched/clock_uptime() and lib/time/lib_time.c: Add support for 1 second uptime + interface. + * net/net_dup2.c and include/nuttx/net.h: The conditional compilation for + '#if CONFIG_NFILE_DESCRIPTOR > 0' was wrong in both of these files. It should + be '#if CONFIG_NFILE_DESCRIPTORS > 0'. This causes a dup2() failure in THTTPD + and a failure to get a CGI page. The consequence can be a very serious bug! apps-6.1 2011-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr> diff --git a/nuttx/fs/fs_dup2.c b/nuttx/fs/fs_dup2.c index 383d518b2..e5c2fe869 100644 --- a/nuttx/fs/fs_dup2.c +++ b/nuttx/fs/fs_dup2.c @@ -1,7 +1,7 @@ /**************************************************************************** * fs/fs_dup2.c * - * Copyright (C) 2007-2009 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -38,6 +38,7 @@ ****************************************************************************/ #include <nuttx/config.h> + #include <unistd.h> #include <sched.h> #include <errno.h> @@ -79,7 +80,7 @@ int dup2(int fildes1, int fildes2) if ((unsigned int)fildes1 >= CONFIG_NFILE_DESCRIPTORS) { - /* Not a vailid file descriptor. Did we get a valid socket descriptor? */ + /* Not a valid file descriptor. Did we get a valid socket descriptor? */ if ((unsigned int)fildes1 < (CONFIG_NFILE_DESCRIPTORS+CONFIG_NSOCKET_DESCRIPTORS)) { diff --git a/nuttx/fs/fs_filedup.c b/nuttx/fs/fs_filedup.c index 60dd9720a..84431b9b1 100644 --- a/nuttx/fs/fs_filedup.c +++ b/nuttx/fs/fs_filedup.c @@ -1,7 +1,7 @@ /**************************************************************************** * fs/fs_filedup.c * - * Copyright (C) 2007-2009 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -43,6 +43,7 @@ #include <errno.h> #include <nuttx/fs.h> + #include "fs_internal.h" #if CONFIG_NFILE_DESCRIPTORS > 0 @@ -109,7 +110,7 @@ int file_dup(int fildes, int minfd) if (fildes2 < 0) { errno = EMFILE; - inode_release(list->fl_files[fildes].f_inode); + inode_release(list->fl_files[fildes].f_inode); return ERROR; } return fildes2; diff --git a/nuttx/fs/fs_filedup2.c b/nuttx/fs/fs_filedup2.c index b9ba2d194..30a4a3aa0 100644 --- a/nuttx/fs/fs_filedup2.c +++ b/nuttx/fs/fs_filedup2.c @@ -1,7 +1,7 @@ /**************************************************************************** * fs/fs_filedup2.c * - * Copyright (C) 2007-2009 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -42,6 +42,7 @@ #include <unistd.h> #include <sched.h> #include <errno.h> + #include "fs_internal.h" #if CONFIG_NFILE_DESCRIPTORS > 0 @@ -109,8 +110,8 @@ int dup2(int fildes1, int fildes2) if ((unsigned int)fildes2 >= CONFIG_NFILE_DESCRIPTORS) { - errno = EBADF; - return ERROR; + errno = EBADF; + return ERROR; } return files_dup(&list->fl_files[fildes1], &list->fl_files[fildes2]); diff --git a/nuttx/include/nuttx/net.h b/nuttx/include/nuttx/net.h index 3d96f4e88..62b2e1673 100644 --- a/nuttx/include/nuttx/net.h +++ b/nuttx/include/nuttx/net.h @@ -177,7 +177,7 @@ EXTERN int net_dup(int sockfd, int minsd); * this function (when both file and socket descriptors are supported) */ -#if CONFIG_NFILE_DESCRIPTOR > 0 +#if CONFIG_NFILE_DESCRIPTORS > 0 EXTERN int net_dup2(int sockfd1, int sockfd2); #else # define net_dup2(sockfd1, sockfd2) dup2(sockfd1, sockfd2) diff --git a/nuttx/net/net_dup2.c b/nuttx/net/net_dup2.c index da7ab9d70..b27bb6967 100644 --- a/nuttx/net/net_dup2.c +++ b/nuttx/net/net_dup2.c @@ -1,7 +1,7 @@ /**************************************************************************** * net/net_dup2.c * - * Copyright (C) 2009 Gregory Nutt. All rights reserved. + * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -63,7 +63,7 @@ * ****************************************************************************/ -#if CONFIG_NFILE_DESCRIPTOR > 0 +#if CONFIG_NFILE_DESCRIPTORS > 0 int net_dup2(int sockfd1, int sockfd2) #else int dup2(int sockfd1, int sockfd2) |