I have made inotifyFunc
to monitor two paths. Nothing is giving me an error except the last line [the code that I have taken from the main function] that is monitor.wd[0]
. The error is
warning: passing argument 3 of ‘inotifyFunc’ makes pointer from integer without a cast
I don't know what is the problem? Although the above line monitor.wd[0] = *pathname1;
didn't give me an error.
void inotifyFunc(char *path, uint32_t *maskPtr, int *wd[2]){
monitor.fd = inotify_init();
if(fcntl(monitor.fd, F_SETFL, O_NONBLOCK)){
perror("inotify not initialized: ");
exit(0);
}
*wd[0] = inotify_add_watch(monitor.fd, path, *maskPtr);
*wd[1] = inotify_add_watch(monitor.fd, path, *maskPtr);
if(*wd[0] < 0 || *wd[1] < 0){
perror("Sorry");
exit(1);
}
}
Code taken from the main function
monitor.mask[0] = ENOENT;
monitor.mask[1] = IN_CREATE;
printf("Choose the source path: ");
scanf("%s", pathname1);
monitor.wd[0] = *pathname1;
inotifyFunc(pathname1, &monitor.mask[0], monitor.wd[0]);