From: uz Date: Sun, 3 Jun 2012 15:31:19 +0000 (+0000) Subject: Don't set errno when the regular end of directory is reached. Plus minor code X-Git-Tag: V2.14~391 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=2a53124b15e606917913da75a8e5041fdb42e930;p=cc65 Don't set errno when the regular end of directory is reached. Plus minor code cleanup. git-svn-id: svn://svn.cc65.org/cc65/trunk@5677 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/libsrc/cbm/readdir.c b/libsrc/cbm/readdir.c index e7b91cc91..678c343fc 100644 --- a/libsrc/cbm/readdir.c +++ b/libsrc/cbm/readdir.c @@ -52,18 +52,17 @@ struct dirent* __fastcall__ readdir (register DIR* dir) } } + /* Bump the directory offset */ + dir->off += count; + /* End of directory is reached if the buffer contains "blocks free". It is - * sufficient here to check for the leading 'b'. To avoid problems if we're - * called again, read until end of directory. + * sufficient here to check for the leading 'b'. buffer will contain at + * least one byte if we come here. */ - if (count > 0 && buffer[0] == 'b') { - while (_dirread1 (dir, buffer)) ; - return 0; + if (buffer[0] == 'b') { + goto exitpoint; } - /* Bump the directory offset */ - dir->off += count; - /* Parse the buffer for the filename and file type */ i = 0; j = 0;