Files
pumpitupdev_pumptools/src/main/hook/pri/usb-updates.c
T
icex2 eafb2909d1 Appl new code style on whole code base
Use a similar code style to bemanitools though reduce indentation
to 2 spaces. Also some other tweaks to be more similar to google
style.
2021-03-19 15:52:34 +01:00

29 lines
657 B
C

#define LOG_MODULE "prihook-usb-updates"
#include <string.h>
#include "capnhook/hook/filehook.h"
#include "util/log.h"
static enum cnh_result
prihook_usb_updates_filehook(struct cnh_filehook_irp *irp)
{
if (irp->op != CNH_FILEHOOK_IRP_OP_OPEN) {
return cnh_filehook_invoke_next(irp);
}
if (!strcmp(irp->open_filename, "/mnt/0/prime_") ||
!strcmp(irp->open_filename, "/mnt/1/prime_")) {
log_info("Blocking usb update %s", irp->open_filename);
return CNH_RESULT_NO_SUCH_FILE_OR_DIR;
}
return cnh_filehook_invoke_next(irp);
}
void prihook_usb_updates_init(void)
{
cnh_filehook_push_handler(prihook_usb_updates_filehook);
}