Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

alex harju's mask patch

  • Loading branch information...
commit adeb3faf2c8ef173d6eaaa41788489b693569233 1 parent 15d86ea
@massemanet authored
Showing with 15 additions and 5 deletions.
  1. +15 −5 src/inotify_erlang.c
View
20 src/inotify_erlang.c
@@ -137,7 +137,6 @@ void note_encode_mask(ei_x_buff *outp, ulong mask) {
};
int note_decode_mask_atom(const char *atom, ulong *maskout) {
- *maskout = 0;
if (!strcmp("all", atom)) {
*maskout |= IN_ALL_EVENTS;
} else if (!strcmp("access", atom)) {
@@ -193,12 +192,23 @@ int note_decode_mask(char *buf, int *index, ulong *maskout) {
if (note_decode_mask_atom(mstr, maskout) < 0)
return(-1);
} else if (termtype == ERL_LIST_EXT) {
- if (ei_decode_list_header(buf, index, &arity) < 0)
+ if (ei_decode_list_header(buf, index, &arity) < 0) {
return(-1);
- for(count = arity; count <= arity; count++) {
+ }
- if (note_decode_mask_atom(mstr, maskout) < 0)
- return(-1);
+ if (arity == 0) { /* empty list */
+ return(-1);
+ }
+
+ for(count = 0; count < arity; count++) {
+ ei_get_type(buf, index, &termtype, &size);
+ if (termtype == ERL_ATOM_EXT) {
+ if (ei_decode_atom(buf, index, mstr) < 0)
+ return(-1);
+
+ if (note_decode_mask_atom(mstr, maskout) < 0)
+ return(-1);
+ }
}
} else {
/* another type which is not of interest */
Please sign in to comment.
Something went wrong with that request. Please try again.