Updated libcatch

This commit is contained in:
niansa/tuxifan 2022-09-16 13:46:03 +02:00
parent 0fa3642135
commit b9f7b2686d
2 changed files with 5 additions and 5 deletions

View file

@ -50,7 +50,7 @@ int main(int argc, char **argv) {
return EXIT_FAILURE; return EXIT_FAILURE;
} }
// Initialise inotify // Initialise inotify
CATCH( CATCH1(
inotifier = inotify_init() inotifier = inotify_init()
); );
// Get array of files and commands // Get array of files and commands
@ -58,7 +58,7 @@ int main(int argc, char **argv) {
struct fcmd_pair *assocs = (struct fcmd_pair *)(argv + 1); struct fcmd_pair *assocs = (struct fcmd_pair *)(argv + 1);
struct fcmdwatcher_pair *assocs_watches; struct fcmdwatcher_pair *assocs_watches;
struct fcmdwatcher_pair *watcherpair_ptr; struct fcmdwatcher_pair *watcherpair_ptr;
CATCH(assocs_watches = malloc((sizeof(struct fcmdwatcher_pair) * ((argc - 1) / 2)) + 1)); CATCH1(assocs_watches = malloc((sizeof(struct fcmdwatcher_pair) * ((argc - 1) / 2)) + 1));
// Initlialise inotify further while checking if all files are actual files // Initlialise inotify further while checking if all files are actual files
libcatch_behavior = 2; libcatch_behavior = 2;
for (struct fcmd_pair *thispair = assocs; *(char**)thispair; thispair++) { for (struct fcmd_pair *thispair = assocs; *(char**)thispair; thispair++) {
@ -72,7 +72,7 @@ int main(int argc, char **argv) {
// Initialise inotify further // Initialise inotify further
watcherpair_ptr = &assocs_watches[thispair - assocs]; watcherpair_ptr = &assocs_watches[thispair - assocs];
watcherpair_ptr->pair = thispair; watcherpair_ptr->pair = thispair;
CATCH( CATCH1(
watcherpair_ptr->watcher = inotify_add_watch(inotifier, thispair->fname, IN_OPEN) watcherpair_ptr->watcher = inotify_add_watch(inotifier, thispair->fname, IN_OPEN)
); );
} }
@ -81,7 +81,7 @@ int main(int argc, char **argv) {
struct inotify_event thisevent; struct inotify_event thisevent;
while (1) { while (1) {
// Read new event // Read new event
CATCH( CATCH1(
read(inotifier, &thisevent, sizeof(thisevent) + NAME_MAX + 1) read(inotifier, &thisevent, sizeof(thisevent) + NAME_MAX + 1)
); );
// Find associated event pair // Find associated event pair

@ -1 +1 @@
Subproject commit ff5cd8539ba0012e51f29a1c3e58928f1d1e80a6 Subproject commit 76d61fc2010e0765612da792c2a6c35b1a453e62