Merge pull request #147 from MouseZhangZh/main

Add memset.
This commit is contained in:
iaom 2021-02-25 13:48:50 +08:00 committed by GitHub
commit 051447ec82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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");