Fix: atomic_long_add_unless() returns a boolean
[lttng-modules.git] / lttng-abi.c
index c45c10f42c747fa4d553d08d18900b5bca1a9e08..bee4255d47b4832d15dc2b48d2bc1514b7b41568 100644 (file)
@@ -429,8 +429,8 @@ int lttng_abi_create_channel(struct file *session_file,
                transport_name = "<unknown>";
                break;
        }
-       if (atomic_long_add_unless(&session_file->f_count,
-               1, INT_MAX) == INT_MAX) {
+       if (!atomic_long_add_unless(&session_file->f_count, 1, LONG_MAX)) {
+               ret = -EOVERFLOW;
                goto refcount_error;
        }
        /*
@@ -1038,8 +1038,7 @@ int lttng_abi_create_event(struct file *channel_file,
                goto file_error;
        }
        /* The event holds a reference on the channel */
-       if (atomic_long_add_unless(&channel_file->f_count,
-               1, INT_MAX) == INT_MAX) {
+       if (!atomic_long_add_unless(&channel_file->f_count, 1, LONG_MAX)) {
                ret = -EOVERFLOW;
                goto refcount_error;
        }
This page took 0.025851 seconds and 4 git commands to generate.