diff --git a/defs.h b/defs.h index cbe0dd4..cbacf61 100644 --- a/defs.h +++ b/defs.h @@ -127,6 +127,7 @@ void* memset(void*, int, uint); char* safestrcpy(char*, const char*, int); int strlen(const char*); int strncmp(const char*, const char*, uint); +char* strncpy(char*, const char*, int); // syscall.c int argint(int, int*); diff --git a/fs.c b/fs.c index bc3cccd..eef20e8 100644 --- a/fs.c +++ b/fs.c @@ -455,15 +455,7 @@ writei(struct inode *ip, char *src, uint off, uint n) int namecmp(const char *s, const char *t) { - int i; - - for(i=0; i 0 && (*s++ = *t++) != 0) + ; + while(n-- > 0) + *s++ = 0; + return os; } // Like strncpy but guaranteed to NUL-terminate.