commit 9c856f4792af3c46642b0a4c68f9223010b22f88
parent 2996e211792b182410581bbcb0987d84f2063f90
Author: qorg11 <qorg@vxempire.xyz>
Date: Tue, 21 Jul 2020 01:28:18 +0200
yeah so now the thing closes the file descriptors
Diffstat:
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/cat.c b/src/cat.c
@@ -19,7 +19,7 @@ cat(int fd,const char *filename)
while((c = read(fd,buf,sizeof(buf))) > 0)
write(1,buf,c);
-
+ close(fd);
return 0;
}
int
@@ -31,6 +31,6 @@ main(int argc, char *argv[])
{
cat(1,argv[i]);
}
-
+
return 0;
}
diff --git a/src/cp.c b/src/cp.c
@@ -22,6 +22,7 @@ copy(const char *src, const char *dst)
char buf[8912];
while((lines = read(source,buf,sizeof(buf))) > 0)
write(destination,buf,lines);
+ close(destination); close(source);
return 0;
}