diff --git a/src/dir_common.c b/src/dir_common.c
index 234ab9b3e3ba374bdaa86707fd05ae1db6c40999..ee80c81da161bfde522f12e65d3ceb35a46f36d2 100644
--- a/src/dir_common.c
+++ b/src/dir_common.c
@@ -87,7 +87,7 @@ void dir_setlasterr(const char *path) {
     lasterrl = req;
     lasterr = realloc(lasterr, lasterrl);
   }
-  strcpy(lasterr, dir_curpath);
+  strcpy(lasterr, path);
 }