Add memset.

This commit is contained in:
MouseZhangZh 2021-02-25 09:37:57 +08:00
parent 05d1f4143d
commit f289cd1dc2
1 changed files with 2 additions and 0 deletions

View File

@ -355,6 +355,7 @@ void InotifyIndex::run(){
for (;;) { /* Read events forever */
read:
memset(buf, 0x00, BUF_LEN);
numRead = read(m_fd, buf, BUF_LEN);
if (numRead == -1){
@ -422,6 +423,7 @@ fork:
::_exit(0);
}else{
GlobalSettings::getInstance()->setValue(INOTIFY_NORMAL_EXIT, "0");
memset(buf, 0x00, BUF_LEN);
numRead = read(m_fd, buf, BUF_LEN);
if (numRead == -1){
printf("\033[1;31;40mread event error\033[0m\n");