diff --git a/src/modules/files/efuns.c b/src/modules/files/efuns.c
index ab191800377f7d67f8d67bb5f705db59b569683d..8414058454db07f7ef399378b0139c0fc6a6ae57 100644
--- a/src/modules/files/efuns.c
+++ b/src/modules/files/efuns.c
@@ -22,7 +22,7 @@
 #include "file_machine.h"
 #include "file.h"
 
-RCSID("$Id: efuns.c,v 1.55 1998/07/02 19:49:59 grubba Exp $");
+RCSID("$Id: efuns.c,v 1.56 1998/07/02 21:02:31 grubba Exp $");
 
 #ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
@@ -482,6 +482,7 @@ void f_get_dir(INT32 args)
 	 * at end of dir it sets the third arg to NULL.
 	 */
 	d = NULL;
+	errno = 0;
 	if ((err = readdir_r(dir, tmp, &d)) || !d) {
 	  if (err == -1) {
 	    err = errno;