+ result = cmd->func(argc, argv);
+ if (result) {
+ switch (result) {
+ case CMD_ERROR:
+ case CMD_UNDEFINED:
+ case CMD_FATAL:
+ case CMD_WARNING:
+ case CMD_UNSUPPORTED:
+ /*
+ * Sub-commands mix lttng_error_codes
+ * and cmd_error_codes. This should be
+ * cleaned-up, but in the meantime this
+ * hack works since the values of the
+ * two enums do not intersect.
+ */
+ cmd_ret = result;
+ break;
+ case -LTTNG_ERR_SNAPSHOT_NODATA:
+ WARN("%s", lttng_strerror(result));
+
+ /* A warning is fine since the user has no control on
+ * whether or not applications (or the kernel) have
+ * produced any event between the start of the tracing
+ * session and the recording of the snapshot. MI wise
+ * the command is not a success since nothing was
+ * recorded.
+ */
+ cmd_ret = CMD_SUCCESS;
+ break;
+ default:
+ ERR("%s", lttng_strerror(result));
+ cmd_ret = CMD_ERROR;
+ break;
+ }
+ } else {
+ cmd_ret = CMD_SUCCESS;
+ }
+