Browse code

onas: adding better feedback for users attempting to use fanotify prevention on kernels with unsupported configurations.

Mickey Sola authored on 2015/09/22 07:28:54
Showing 1 changed files
... ...
@@ -360,6 +360,11 @@ void *onas_ddd_th(void *arg) {
360 360
 			if(onas_ht_get(ddd_ht, pt->strarg, ptlen, NULL) == CL_SUCCESS) {
361 361
 				if(onas_ddd_watch(pt->strarg, tharg->fan_fd, tharg->fan_mask, onas_in_fd, in_mask)) {
362 362
 					logg("!ScanOnAccess: Could not watch path '%s', %s\n", pt->strarg, strerror(errno));
363
+					if(errno == EINVAL && optget(tharg->opts, "OnAccessPrevention")->enabled) {
364
+						logg("!ScanOnAccess: When using the OnAccessPrevention option, please ensure your kernel\n\t\t\twas compiled with CONFIG_FANOTIFY_ACCESS_PERMISSIONS set to Y\n");
365
+
366
+						kill(getpid(), SIGTERM);
367
+					}
363 368
 					return NULL;
364 369
 				}
365 370
 			}