Skip to content

Commit 2beea75

Browse files
authored
Merge pull request #113 from andrewbird/dir-01
DIR: don't display invalid data with devices
2 parents ba4c1b1 + e50fa43 commit 2beea75

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

ci_prereq.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/bin/sh
22

3+
sudo apt update
34
sudo apt install -y \
45
devscripts \
56
equivs

src/command.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@
5050
*/
5151

5252
#include <dos.h>
53+
#ifndef _A_DEVICE
54+
#define _A_DEVICE 0x40u
55+
#endif
5356
#include <libc/dosio.h>
5457
#include <io.h>
5558
#include <libc/getdinfo.h>
@@ -2693,7 +2696,8 @@ static void perform_dir(const char *arg)
26932696
}
26942697
if (first)
26952698
{
2696-
if ((ffrc = findfirst_f(full_filespec, &ff, attrib, &ffhandle)) != 0)
2699+
if (((ffrc = findfirst_f(full_filespec, &ff, attrib, &ffhandle)) != 0) ||
2700+
ff.ff_attrib == _A_DEVICE )
26972701
{
26982702
puts("File not found"); // informational message -- not an error
26992703
return;

0 commit comments

Comments
 (0)