Back out 522f95abe87d71c7025f2f358a8f350134e284b2: What was I thinking?

This commit is contained in:
Gregory Nutt 2015-12-02 10:47:32 -06:00
parent 7d3d49e227
commit 7be7579f59
2 changed files with 17 additions and 27 deletions

View file

@ -41,32 +41,16 @@
#include "inode/inode.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Private Variables
****************************************************************************/
/****************************************************************************
* Public Data
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: inode_nextname
* Name: inode_basename
*
* Description:
* Given a path with node names separated by '/', return the next node
* name.
* Given a path with node names separated by '/', return name of last
* segment in the path. ""
*
****************************************************************************/
@ -84,13 +68,19 @@ FAR const char *inode_basename(FAR const char *name)
* previous name that we saved is the basename.
*/
if (*name == '\0')
if (name == NULL || *name == '\0')
{
return basename;
/* Break out of the loop with basename pointer to the final
* segment of the path.
*/
break;
}
/* Set basename to point to the remainder of the path */
basename = name;
}
/* We won't get here */
return NULL;
return basename;
}

View file

@ -60,12 +60,12 @@
struct inode;
struct nsem_inode_s
{
/* Inode payload unique to named semaphores. ns_sem must appear first in
* this structure in order to support casting between type sem_t and
/* Inode payload unique to named semaphores. ns_inode must appear first
* in this structure in order to support casting between type sem_t and
* types of struct nsem_inode_s. */
sem_t ns_sem; /* The semaphore */
FAR struct inode *ns_inode; /* Containing inode */
sem_t ns_sem; /* The semaphore */
};
#endif