- if (ksession->snapshot_mode) {
- /* Force channel attribute for snapshot mode. */
- attr->attr.overwrite = 1;
- attr->attr.output = LTTNG_EVENT_MMAP;
+ /*
+ * Set the overwrite mode for this channel based on the session
+ * type unless the client explicitly overrides the channel mode.
+ */
+ if (attr->attr.overwrite == DEFAULT_CHANNEL_OVERWRITE) {
+ attr->attr.overwrite = !!ksession->snapshot_mode;
+ }
+
+ /* Validate common channel properties. */
+ if (channel_validate(attr) < 0) {
+ ret = LTTNG_ERR_INVALID;
+ goto error;
+ }
+
+ if (channel_validate_kernel(attr) < 0) {
+ ret = LTTNG_ERR_INVALID;
+ goto error;