Index: trunk/src/emx/include/direct.h
===================================================================
--- trunk/src/emx/include/direct.h	(revision 1673)
+++ trunk/src/emx/include/direct.h	(revision 1674)
@@ -55,7 +55,7 @@
 int rmdir (const char *);
 
-int _chdrive(char);
+int _chdrive(int);
 char * _getdcwd(int, char *, int);
-char _getdrive(void);
+int _getdrive(void);
 
 /* Special LIBC addition. */
Index: trunk/src/emx/include/stdlib.h
===================================================================
--- trunk/src/emx/include/stdlib.h	(revision 1673)
+++ trunk/src/emx/include/stdlib.h	(revision 1674)
@@ -420,5 +420,5 @@
 long double _atofl (__const__ char *);
 int _chdir2 (__const__ char *);
-int _chdrive (char);
+int _chdrive (int);
 int _core (int);
 void _defext (char *, __const__ char *);
@@ -438,5 +438,5 @@
 int _getcwd1 (char *, char);
 char *_getcwd2 (char *, int);
-char _getdrive (void);
+int _getdrive (void);
 char *_getext (__const__ char *);
 char *_getext2 (__const__ char *);
Index: trunk/src/emx/src/lib/misc/_chdrive.c
===================================================================
--- trunk/src/emx/src/lib/misc/_chdrive.c	(revision 1673)
+++ trunk/src/emx/src/lib/misc/_chdrive.c	(revision 1674)
@@ -1,12 +1,54 @@
-/* sys/chdrive.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes */
+/* $Id$ */
+/** @file
+ *
+ * _chdrive.
+ *
+ * Copyright (c) 2004 knut st. osmundsen <bird@innotek.de>
+ *
+ *
+ * This file is part of InnoTek LIBC.
+ *
+ * InnoTek LIBC is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * InnoTek LIBC is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with InnoTek LIBC; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
 
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
 #include "libc-alias.h"
 #include <direct.h>
+#include <stdlib.h>
+#include <errno.h>
 #include <InnoTekLIBC/backend.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_MISC
+#include <InnoTekLIBC/logstrict.h>
 
-int _chdrive (char drive)
+/**
+ * Gets the current default drive.
+ *
+ * @returns Current default drive as an uppercased letter.
+ * @returns -1 and errno on failure.
+ * @param   chDrive     The new drive letter.
+ */
+int _chdrive(int chDrive)
 {
-    __libc_Back_fsDriveDefaultSet(drive);
-    /* for some reason this function doesn't return errors. */
-    return 0;
+    LIBCLOG_ENTER("chDrive=%d (%c)\n", chDrive, chDrive);
+    int rc = __libc_Back_fsDriveDefaultSet(chDrive);
+    if (!rc)
+        LIBCLOG_RETURN_INT(0);
+    errno = -rc;
+    LIBCLOG_RETURN_INT(-1);
 }
+
Index: trunk/src/emx/src/lib/misc/_getdrive.c
===================================================================
--- trunk/src/emx/src/lib/misc/_getdrive.c	(revision 1673)
+++ trunk/src/emx/src/lib/misc/_getdrive.c	(revision 1674)
@@ -1,17 +1,53 @@
-/* sys/getdrive.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes */
+/* $Id$ */
+/** @file
+ *
+ * _getdrive.
+ *
+ * Copyright (c) 2004 knut st. osmundsen <bird@innotek.de>
+ *
+ *
+ * This file is part of InnoTek LIBC.
+ *
+ * InnoTek LIBC is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * InnoTek LIBC is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with InnoTek LIBC; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
 
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
 #include "libc-alias.h"
 #include <direct.h>
+#include <stdlib.h>
 #include <errno.h>
 #include <InnoTekLIBC/backend.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_MISC
+#include <InnoTekLIBC/logstrict.h>
 
-char _getdrive (void)
+/**
+ * Gets the current default drive.
+ *
+ * @returns Current default drive as an uppercased letter.
+ * @returns -1 and errno on failure.
+ */
+int _getdrive(void)
 {
+    LIBCLOG_ENTER("\n");
     char chDrive;
     int rc = __libc_Back_fsDriveDefaultGet(&chDrive);
     if (!rc)
-        return chDrive - 'A' + 1;
-
+        LIBCLOG_RETURN_MSG(chDrive, "ret %d (%c)\n", chDrive, chDrive);
     errno = -rc;
-    return 0;
+    LIBCLOG_RETURN_INT(-1);
 }
Index: trunk/src/emx/src/lib/sys/b_fs.h
===================================================================
--- trunk/src/emx/src/lib/sys/b_fs.h	(revision 1673)
+++ trunk/src/emx/src/lib/sys/b_fs.h	(revision 1674)
@@ -118,9 +118,17 @@
  * @{ */
 /** Resolves the path up to but not including the last component. */
-#define BACKFS_FLAGS_RESOLVE_PARENT     0x1
+#define BACKFS_FLAGS_RESOLVE_PARENT         0
 /** Resolves and verfies the entire path. */
-#define BACKFS_FLAGS_RESOLVE_FULL       0x2
+#define BACKFS_FLAGS_RESOLVE_FULL           1
 /** Resolves and verfies the entire path but it's ok if the last component doesn't exist. */
-#define BACKFS_FLAGS_RESOLVE_FULL_MAYBE 0x3
+#define BACKFS_FLAGS_RESOLVE_FULL_MAYBE     (BACKFS_FLAGS_RESOLVE_FULL | BACKFS_FLAGS_RESOLVE_FULL_MAYBE_)
+/** Internal, use BACKFS_FLAGS_RESOLVE_FULL_MAYBE. */
+#define BACKFS_FLAGS_RESOLVE_FULL_MAYBE_    2
+/** The specified path is a directory. */
+#define BACKFS_FLAGS_RESOLVE_DIR            4
+/** The specified path maybe a directory. */
+#define BACKFS_FLAGS_RESOLVE_DIR_MAYBE      (BACKFS_FLAGS_RESOLVE_DIR | BACKFS_FLAGS_RESOLVE_DIR_MAYBE_)
+/** Internal, use BACKFS_FLAGS_RESOLVE_DIR_MAYBE. */
+#define BACKFS_FLAGS_RESOLVE_DIR_MAYBE_     8
 /** @} */
 
Index: trunk/src/emx/src/lib/sys/b_fsDirChangeRoot.c
===================================================================
--- trunk/src/emx/src/lib/sys/b_fsDirChangeRoot.c	(revision 1673)
+++ trunk/src/emx/src/lib/sys/b_fsDirChangeRoot.c	(revision 1674)
@@ -61,5 +61,5 @@
      */
     char szNativePath[PATH_MAX];
-    rc = __libc_back_fsResolve(pszNewRoot, BACKFS_FLAGS_RESOLVE_FULL, &szNativePath[0], NULL);
+    rc = __libc_back_fsResolve(pszNewRoot, BACKFS_FLAGS_RESOLVE_FULL | BACKFS_FLAGS_RESOLVE_DIR, &szNativePath[0], NULL);
     if (!rc)
     {
Index: trunk/src/emx/src/lib/sys/b_fsDirCreate.c
===================================================================
--- trunk/src/emx/src/lib/sys/b_fsDirCreate.c	(revision 1673)
+++ trunk/src/emx/src/lib/sys/b_fsDirCreate.c	(revision 1674)
@@ -59,5 +59,5 @@
      */
     char szNativePath[PATH_MAX];
-    int rc = __libc_back_fsResolve(pszPath, BACKFS_FLAGS_RESOLVE_PARENT, &szNativePath[0], NULL);
+    int rc = __libc_back_fsResolve(pszPath, BACKFS_FLAGS_RESOLVE_PARENT | BACKFS_FLAGS_RESOLVE_DIR, &szNativePath[0], NULL);
     if (rc)
         LIBCLOG_RETURN_INT(rc);
Index: trunk/src/emx/src/lib/sys/b_fsDirCurrentSet.c
===================================================================
--- trunk/src/emx/src/lib/sys/b_fsDirCurrentSet.c	(revision 1673)
+++ trunk/src/emx/src/lib/sys/b_fsDirCurrentSet.c	(revision 1674)
@@ -62,5 +62,5 @@
     int     fInUnixTree;
     char    szNativePath[PATH_MAX];
-    rc = __libc_back_fsResolve(pszPath, BACKFS_FLAGS_RESOLVE_FULL, &szNativePath[0], &fInUnixTree);
+    rc = __libc_back_fsResolve(pszPath, BACKFS_FLAGS_RESOLVE_FULL | BACKFS_FLAGS_RESOLVE_DIR, &szNativePath[0], &fInUnixTree);
     if (!rc)
     {
Index: trunk/src/emx/src/lib/sys/b_fsDirRemove.c
===================================================================
--- trunk/src/emx/src/lib/sys/b_fsDirRemove.c	(revision 1673)
+++ trunk/src/emx/src/lib/sys/b_fsDirRemove.c	(revision 1674)
@@ -56,5 +56,5 @@
      */
     char szNativePath[PATH_MAX];
-    int rc = __libc_back_fsResolve(pszPath, BACKFS_FLAGS_RESOLVE_FULL, &szNativePath[0], NULL);
+    int rc = __libc_back_fsResolve(pszPath, BACKFS_FLAGS_RESOLVE_FULL | BACKFS_FLAGS_RESOLVE_DIR, &szNativePath[0], NULL);
     if (rc)
         LIBCLOG_RETURN_INT(rc);
Index: trunk/src/emx/src/lib/sys/b_fsSymlinkCreate.c
===================================================================
--- trunk/src/emx/src/lib/sys/b_fsSymlinkCreate.c	(revision 1673)
+++ trunk/src/emx/src/lib/sys/b_fsSymlinkCreate.c	(revision 1674)
@@ -54,5 +54,5 @@
      */
     char szNativePath[PATH_MAX];
-    int rc = __libc_back_fsResolve(pszSymlink, BACKFS_FLAGS_RESOLVE_PARENT, &szNativePath[0], NULL);
+    int rc = __libc_back_fsResolve(pszSymlink, BACKFS_FLAGS_RESOLVE_PARENT | BACKFS_FLAGS_RESOLVE_DIR_MAYBE, &szNativePath[0], NULL);
     if (!rc)
         rc = __libc_back_fsNativeSymlinkCreate(pszTarget, &szNativePath[0]);
Index: trunk/src/emx/src/lib/sys/fs.c
===================================================================
--- trunk/src/emx/src/lib/sys/fs.c	(revision 1673)
+++ trunk/src/emx/src/lib/sys/fs.c	(revision 1674)
@@ -593,6 +593,8 @@
  * @returns Number of bytes in the clean path.
  * @param   pszPath     The path to cleanup.
+ * @parm    fFlags          Flags controlling the operation of the function.
+ *                          See the BACKFS_FLAGS_* defines.
  */
-static int fsCleanPath(char *pszPath)
+static int fsCleanPath(char *pszPath, int fFlags)
 {
     /*
@@ -633,8 +635,12 @@
 
     /*
-     * Remove trailing slash.
+     * Remove trailing slash if the path may be pointing to a directory.
      */
     int cch = pszTrg - pszPath;
-    if (cch > 1 && pszTrg[-1] == '/' && pszTrg[-2] != ':' && pszTrg[-2] != '/')
+    if (    (fFlags & BACKFS_FLAGS_RESOLVE_DIR)
+        &&  cch > 1
+        &&  pszTrg[-1] == '/'
+        &&  pszTrg[-2] != ':'
+        &&  pszTrg[-2] != '/')
         pszPath[--cch] = '\0';
 
@@ -720,9 +726,9 @@
     unsigned    cLoopsLeft = 8;
     int         fInUnixTree = __libc_gfInUnixTree;
-    int         rcRet = -ENAMETOOLONG;
+    int         rcRet = 0;
     HDIR        hDir = HDIR_CREATE;
     FS_VAR()
     FS_SAVE_LOAD();
-    while (cLoopsLeft-- > 0)
+    for (;;)
     {
         /*
@@ -791,5 +797,8 @@
             int cchUserPath = strlen(pszUserPath) + 1;
             if (cch + cchUserPath > PATH_MAX)
+            {
+                rcRet = -ENAMETOOLONG;
                 break;
+            }
             memcpy(&szTmp[cch], pszUserPath, cchUserPath);
             pszUserPath = memcpy(pachBuffer, szTmp, cch + cchUserPath);
@@ -823,5 +832,4 @@
             /*
              * Redetermin root because of rewrite.
-             * Assume qualified path from rewrite!
              */
             iRoot = szTmp[1] == ':' ? 2 : 1;
@@ -831,5 +839,8 @@
             cchTmp = strlen(pszUserPath);
             if (cchTmp + 2 > sizeof(szTmp))
+            {
+                rcRet = -ENAMETOOLONG;
                 break;
+            }
             memcpy(szTmp, pszUserPath, cchTmp + 1);
         }
@@ -870,7 +881,9 @@
                 {
                     memcpy(szTmp, pszUserPath, cchTmp + 1);
-                    fsCleanPath(&szTmp[0]);
+                    fsCleanPath(&szTmp[0], fFlags);
                     rcRet = 0;
                 }
+                else
+                    rcRet = -ENAMETOOLONG;
                 break;
             }
@@ -880,5 +893,5 @@
          * Remove excessive slashing and convert all slashes to '/'.
          */
-        cchTmp = fsCleanPath(&szTmp[0]);
+        cchTmp = fsCleanPath(&szTmp[0], fFlags);
 
         /*
@@ -889,5 +902,8 @@
             iRoot = __libc_gcchUnixRoot;
             if (cchTmp + iRoot >= PATH_MAX)
+            {
+                rcRet = -ENAMETOOLONG;
                 break;
+            }
             memcpy(pachBuffer, szTmp, cchTmp + 1);
             memcpy(szTmp, __libc_gszUnixRoot, iRoot);
@@ -939,5 +955,6 @@
         /* If only one component, we'll check if the fVerifyLast was requested. */
         if (    !psz
-            &&  (fFlags == BACKFS_FLAGS_RESOLVE_FULL || fFlags == BACKFS_FLAGS_RESOLVE_FULL_MAYBE))
+            &&  (fFlags & BACKFS_FLAGS_RESOLVE_FULL)
+            &&  *pszPrev)
             psz = strchr(szTmp, '\0');
 
@@ -974,5 +991,5 @@
                 if (!chSlash)
                 {
-                    rcRet = -0;
+                    rcRet = 0;
                     break;
                 }
@@ -980,15 +997,15 @@
                 while (*psz != '/')
                 {
-                    if (!*psz)
+                    if (*psz)
+                        psz++;
+                    else
                     {
-                        if (    fFlags != BACKFS_FLAGS_RESOLVE_FULL
-                            &&  fFlags != BACKFS_FLAGS_RESOLVE_FULL_MAYBE)
+                        if (!(fFlags & BACKFS_FLAGS_RESOLVE_FULL))
                         {
-                            rcRet = -0;
+                            rcRet = 0;
                             psz = NULL;
                         }
                         break;
                     }
-                    psz++;
                 }
                 continue;
@@ -1016,5 +1033,5 @@
             {
                 LIBCLOG_MSG("DosFindFirst('%s',,,,,) -> %d resolving '%s'\n", szTmp, rc, pszUserPathIn);
-                if (fFlags == BACKFS_FLAGS_RESOLVE_FULL_MAYBE && !chSlash)
+                if ((fFlags & BACKFS_FLAGS_RESOLVE_FULL_MAYBE_) && !chSlash)
                     rcRet = 0;
                 else
@@ -1046,5 +1063,5 @@
                 {
                     LIBCLOG_MSG("DosQueryPathInfo('%s',,,) -> %d resolving '%s'\n", szTmp, rc, pszUserPathIn);
-                    if (fFlags == BACKFS_FLAGS_RESOLVE_FULL_MAYBE && !chSlash)
+                    if ((fFlags & BACKFS_FLAGS_RESOLVE_FULL_MAYBE_) && !chSlash)
                         rcRet = 0;
                     else
@@ -1073,7 +1090,14 @@
                     }
 
+                    /* Check if we've reached the max number of symlink loops before we continue. */
+                    if (cLoopsLeft-- <= 0)
+                    {
+                        rcRet = -ELOOP;
+                        break;
+                    }
+
                     /* Cleanup the symlink and find it's length. */
                     pszSymlink[pusType[1]] = '\0';
-                    int cchSymlink = fsCleanPath(pszSymlink);
+                    int cchSymlink = fsCleanPath(pszSymlink, fFlags);
 
                     /* Merge symlink with the path. */
@@ -1085,5 +1109,8 @@
                          */
                         if (cchSymlink + cchLeft + 2 >= PATH_MAX)
+                        {
+                            rcRet = -ENAMETOOLONG;
                             break;
+                        }
                         if (cchLeft)
                         {
@@ -1104,5 +1131,8 @@
                          */
                         if (cchSymlink + cchTmp + 2 >= PATH_MAX)
+                        {
+                            rcRet = -ENAMETOOLONG;
                             break;
+                        }
                         if (cchLeft)
                         {
@@ -1116,8 +1146,9 @@
                         while (*psz != '/')
                         {
-                            if (!*psz)
+                            if (*psz)
+                                psz++;
+                            else
                             {
-                                if (    fFlags != BACKFS_FLAGS_RESOLVE_FULL
-                                    &&  fFlags != BACKFS_FLAGS_RESOLVE_FULL_MAYBE)
+                                if (!(fFlags & BACKFS_FLAGS_RESOLVE_FULL))
                                 {
                                     rcRet = 0;
@@ -1126,5 +1157,4 @@
                                 break;
                             }
-                            psz++;
                         }
                         continue;
@@ -1158,6 +1188,5 @@
                 if (!*psz)
                 {
-                    if (    fFlags != BACKFS_FLAGS_RESOLVE_FULL
-                        &&  fFlags != BACKFS_FLAGS_RESOLVE_FULL_MAYBE)
+                    if (!(fFlags & BACKFS_FLAGS_RESOLVE_FULL))
                     {
                         rcRet = 0;
Index: trunk/src/emx/testcase/libc/miscinnotek/fsinternals.c
===================================================================
--- trunk/src/emx/testcase/libc/miscinnotek/fsinternals.c	(revision 1673)
+++ trunk/src/emx/testcase/libc/miscinnotek/fsinternals.c	(revision 1674)
@@ -2,19 +2,11 @@
 #include <string.h>
 #include <errno.h>
-
-int __libc_back_fsResolve(const char *pszUserPath, unsigned fFlags, char *pszNativePath, int *pfInUnixTree);
-
-/** __libc_back_fsResolve() flags.
- * @{ */
-/** Resolves the path up to but not including the last component. */
-#define BACKFS_FLAGS_RESOLVE_PARENT     0x1
-/** Resolves and verfies the entire path. */
-#define BACKFS_FLAGS_RESOLVE_FULL       0x2
-/** Resolves and verfies the entire path but it's ok if the last component doesn't exist. */
-#define BACKFS_FLAGS_RESOLVE_FULL_MAYBE 0x3
-/** @} */
+#include "../../../src/lib/sys/b_fs.h"
 
 
-int main (int argc, char *argv[])
+/**
+ * Do one call, check and report the result.
+ */
+static int testit(const char *pszPath, unsigned fFlags, int rcCorrect)
 {
     char    szNativePath[300];
@@ -22,33 +14,62 @@
 
     memset(szNativePath, 0xAA, sizeof(szNativePath));
+    szNativePath[sizeof(szNativePath) - 1] = '\0';
     errno = 0;
-    rc = __libc_back_fsResolve(".", BACKFS_FLAGS_RESOLVE_FULL, szNativePath, NULL);
-    printf("+ '.' -> rc=%d errno=%d szNativePath=%s\n", rc, errno, szNativePath);
+    rc = __libc_back_fsResolve(pszPath, fFlags, szNativePath, NULL);
+    if (errno != 0)
+        printf("FAILURE: flags=%#02x path='%s' -> rc=%d errno=%d szNativePath='%s' ERRNO CHANGED!\n", fFlags, pszPath, rc, errno, szNativePath);
+    else if (!rcCorrect)
+    {
+        /*
+         * Positive test.
+         */
+        if (!rc)
+        {
+            if (!strchr(szNativePath, 0xAA))
+            {
+                printf("SUCCESS: flags=%#02x path='%s' -> szNativePath='%s'\n", fFlags, pszPath, szNativePath);
+                return 0;
+            }
+            else
+                printf("FAILURE: flags=%#02x path='%s' -> rc=%d szNativePath='%s' PADDING!\n", fFlags, pszPath, rc, szNativePath);
+        }
+        else
+            printf("FAILURE: flags=%#02x path='%s' -> rc=%d szNativePath='%s' (failed)\n", fFlags, pszPath, rc, szNativePath);
+    }
+    else
+    {
+        /*
+         * Negative test.
+         */
+        if (rc == rcCorrect)
+        {
+            printf("SUCCESS: flags=%#02x path='%s' -> rc=%d (negative)\n", fFlags, pszPath, rc);
+            return 0;
+        }
+        else
+            printf("FAILURE: flags=%#02x path='%s' -> rc=%d not %d! (negative)\n", fFlags, pszPath, rc, rcCorrect);
+    }
+    return 1;
+}
 
-    memset(szNativePath, 0xAA, sizeof(szNativePath));
-    errno = 0;
-    rc = __libc_back_fsResolve("/", BACKFS_FLAGS_RESOLVE_FULL, szNativePath, NULL);
-    printf("+ '/' -> rc=%d errno=%d szNativePath=%s\n", rc, errno, szNativePath);
 
-    memset(szNativePath, 0xAA, sizeof(szNativePath));
-    errno = 0;
-    rc = __libc_back_fsResolve("/tmp", BACKFS_FLAGS_RESOLVE_FULL, szNativePath, NULL);
-    printf("+ '/tmp' -> rc=%d errno=%d szNativePath=%s\n", rc, errno, szNativePath);
+int main (int argc, char *argv[])
+{
+    int     rcRet = 0;
 
-    memset(szNativePath, 0xAA, sizeof(szNativePath));
-    errno = 0;
-    rc = __libc_back_fsResolve("/tmp", BACKFS_FLAGS_RESOLVE_PARENT, szNativePath, NULL);
-    printf("+ '/tmp' (parent) -> rc=%d errno=%d szNativePath=%s\n", rc, errno, szNativePath);
 
-    memset(szNativePath, 0xAA, sizeof(szNativePath));
-    errno = 0;
-    rc = __libc_back_fsResolve("/nosuchdir", BACKFS_FLAGS_RESOLVE_PARENT, szNativePath, NULL);
-    printf("+ '/nosuchdir' (parent) -> rc=%d errno=%d szNativePath=%s\n", rc, errno, szNativePath);
-
-    memset(szNativePath, 0xAA, sizeof(szNativePath));
-    errno = 0;
-    rc = __libc_back_fsResolve("/nosuchdir/nosuchsubdir", BACKFS_FLAGS_RESOLVE_PARENT, szNativePath, NULL);
-    printf("- '/nosuchdir/nosuchsubdir' (parent) -> rc=%d errno=%d szNativePath=%s\n", rc, errno, szNativePath);
-
+    rcRet += testit(".", BACKFS_FLAGS_RESOLVE_FULL, 0);
+    rcRet += testit("/", BACKFS_FLAGS_RESOLVE_FULL, 0);
+    rcRet += testit("/tmp", BACKFS_FLAGS_RESOLVE_FULL, 0);
+    rcRet += testit("/tmp/", BACKFS_FLAGS_RESOLVE_FULL, -ENOENT);
+    rcRet += testit("/tmp/", BACKFS_FLAGS_RESOLVE_FULL | BACKFS_FLAGS_RESOLVE_DIR, 0);
+    rcRet += testit("/tmp", BACKFS_FLAGS_RESOLVE_PARENT, 0);
+    rcRet += testit("/tmp/", BACKFS_FLAGS_RESOLVE_PARENT, -ENOENT);
+    rcRet += testit("/tmp/", BACKFS_FLAGS_RESOLVE_PARENT | BACKFS_FLAGS_RESOLVE_DIR, 0);
+    rcRet += testit("/tmp/NoSuchSubDir", BACKFS_FLAGS_RESOLVE_PARENT, 0);
+    rcRet += testit("/tmp/NoSuchSubDir/", BACKFS_FLAGS_RESOLVE_PARENT, -ENOENT);
+    rcRet += testit("/tmp/NoSuchSubDir/", BACKFS_FLAGS_RESOLVE_PARENT | BACKFS_FLAGS_RESOLVE_DIR, 0);
+    rcRet += testit("/nosuchdir", BACKFS_FLAGS_RESOLVE_PARENT, 0);
+    rcRet += testit("/nosuchdir/nosuchsubdir", BACKFS_FLAGS_RESOLVE_PARENT, -ENOENT);
 
     return 0;
