(fts_open): Fail with EINVAL if a caller violates this rule:
authorJim Meyering <jim@meyering.net>
Sat, 20 May 2006 22:18:16 +0000 (22:18 +0000)
committerJim Meyering <jim@meyering.net>
Sat, 20 May 2006 22:18:16 +0000 (22:18 +0000)
Either FTS_LOGICAL or FTS_PHYSICAL must be provided to the
fts_open() function.

lib/fts.c

index 2d4e333..5ea1397 100644 (file)
--- a/lib/fts.c
+++ b/lib/fts.c
@@ -291,6 +291,10 @@ fts_open (char * const *argv,
                __set_errno (EINVAL);
                return (NULL);
        }
+       if ( ! (options & (FTS_LOGICAL | FTS_PHYSICAL))) {
+               __set_errno (EINVAL);
+               return (NULL);
+       }
 
        /* Allocate/initialize the stream */
        if ((sp = malloc(sizeof(FTS))) == NULL)