X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Flib%2Flttng-ctl%2Fsave.c;h=90ab941878581160f5a119390221f84f0502b1c0;hp=d2a7e67c55a14b75719ada6355b970039f292f9c;hb=25357057de5ae4dd2a572e8f9b893c1b90cbd60a;hpb=36d2e35df61339e4394e84ad9790b984d259e0f0 diff --git a/src/lib/lttng-ctl/save.c b/src/lib/lttng-ctl/save.c index d2a7e67c5..90ab94187 100644 --- a/src/lib/lttng-ctl/save.c +++ b/src/lib/lttng-ctl/save.c @@ -1,21 +1,10 @@ /* - * Copyright (C) 2013 - Jérémie Galarneau + * Copyright (C) 2013 Jérémie Galarneau * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License, version 2.1 only, - * as published by the Free Software Foundation. + * SPDX-License-Identifier: LGPL-2.1-only * - * This library is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#define _GNU_SOURCE #define _LGPL_SOURCE #include #include @@ -69,6 +58,18 @@ int lttng_save_session_attr_get_overwrite( return attr ? attr->overwrite : -LTTNG_ERR_INVALID; } +int lttng_save_session_attr_get_omit_name( + struct lttng_save_session_attr *attr) +{ + return attr ? attr->omit_name : -LTTNG_ERR_INVALID; +} + +int lttng_save_session_attr_get_omit_output( + struct lttng_save_session_attr *attr) +{ + return attr ? attr->omit_output : -LTTNG_ERR_INVALID; +} + int lttng_save_session_attr_set_session_name( struct lttng_save_session_attr *attr, const char *session_name) { @@ -88,7 +89,12 @@ int lttng_save_session_attr_set_session_name( goto error; } - strncpy(attr->session_name, session_name, len); + ret = lttng_strncpy(attr->session_name, session_name, + sizeof(attr->session_name)); + if (ret) { + ret = -LTTNG_ERR_INVALID; + goto error; + } } else { attr->session_name[0] = '\0'; } @@ -152,6 +158,36 @@ end: return ret; } +int lttng_save_session_attr_set_omit_name( + struct lttng_save_session_attr *attr, int omit_name) +{ + int ret = 0; + + if (!attr) { + ret = -LTTNG_ERR_INVALID; + goto end; + } + + attr->omit_name = !!omit_name; +end: + return ret; +} + +int lttng_save_session_attr_set_omit_output( + struct lttng_save_session_attr *attr, int omit_output) +{ + int ret = 0; + + if (!attr) { + ret = -LTTNG_ERR_INVALID; + goto end; + } + + attr->omit_output = !!omit_output; +end: + return ret; +} + /* * The lttng-ctl API does not expose all the information needed to save the * session configurations. Thus, we must send a save command to the session