summaryrefslogtreecommitdiff
path: root/source3/param/loadparm.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/param/loadparm.c')
-rw-r--r--source3/param/loadparm.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index a049b2d47a..ea434e4768 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -5299,15 +5299,22 @@ struct share_params *snum2params_static(int snum)
A useful volume label function.
********************************************************************/
-char *volume_label(int snum)
+const char *volume_label(int snum)
{
- char *ret = lp_volume(snum);
- if (!*ret)
- return lp_servicename(snum);
- return (ret);
+ char *ret;
+ const char *label = lp_volume(snum);
+ if (!*label) {
+ label = lp_servicename(snum);
+ }
+
+ /* This returns a 33 byte guarenteed null terminated string. */
+ ret = talloc_strndup(main_loop_talloc_get(), label, 32);
+ if (!ret) {
+ return "";
+ }
+ return ret;
}
-
/*******************************************************************
Set the server type we will announce as via nmbd.
********************************************************************/