Print this page
10122 beadm buffer over-run


  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
  24  * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
  25  * Copyright 2015 Toomas Soome <tsoome@me.com>
  26  * Copyright 2015 Gary Mills
  27  * Copyright (c) 2015 by Delphix. All rights reserved.
  28  * Copyright 2017 Jason King
  29  * Copyright 2018 OmniOS Community Edition (OmniOSce) Association.

  30  */
  31 
  32 /*
  33  * System includes
  34  */
  35 
  36 #include <assert.h>
  37 #include <stdio.h>
  38 #include <strings.h>
  39 #include <libzfs.h>
  40 #include <locale.h>
  41 #include <langinfo.h>
  42 #include <stdlib.h>
  43 #include <wchar.h>
  44 #include <sys/types.h>
  45 #include <sys/debug.h>
  46 #include <libcmdutils.h>
  47 
  48 #include "libbe.h"
  49 


 196                 if (first) {
 197                         (void) printf("%-*s", width, name);
 198                         first = B_FALSE;
 199                 } else
 200                         (void) printf(" %-*s", width, name);
 201         }
 202         (void) putchar('\n');
 203 }
 204 
 205 static void
 206 init_hdr_cols(enum be_fmt be_fmt, struct hdr_info *hdr)
 207 {
 208         struct col_info *col = hdr->cols;
 209         size_t i;
 210 
 211         col[1].col_name = _("Active");
 212         col[2].col_name = _("Mountpoint");
 213         col[3].col_name = _("Space");
 214         col[4].col_name = _("Policy");
 215         col[5].col_name = _("Created");
 216         col[6].col_name = NULL;
 217 
 218         switch (be_fmt) {
 219         case BE_FMT_ALL:
 220                 col[0].col_name = _("BE/Dataset/Snapshot");
 221                 break;
 222         case BE_FMT_DATASET:
 223                 col[0].col_name = _("BE/Dataset");
 224                 break;
 225         case BE_FMT_SNAPSHOT:
 226                 col[0].col_name = _("BE/Snapshot");
 227                 col[1].col_name = NULL;
 228                 col[2].col_name = NULL;
 229                 break;
 230         case BE_FMT_DEFAULT:
 231         default:
 232                 col[0].col_name = _("BE");
 233         }
 234 
 235         for (i = 0; i < NUM_COLS; i++) {
 236                 const char *name = col[i].col_name;




  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
  24  * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
  25  * Copyright 2015 Toomas Soome <tsoome@me.com>
  26  * Copyright 2015 Gary Mills
  27  * Copyright (c) 2015 by Delphix. All rights reserved.
  28  * Copyright 2017 Jason King
  29  * Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
  30  * Copyright (c) 2018, Joyent, Inc.
  31  */
  32 
  33 /*
  34  * System includes
  35  */
  36 
  37 #include <assert.h>
  38 #include <stdio.h>
  39 #include <strings.h>
  40 #include <libzfs.h>
  41 #include <locale.h>
  42 #include <langinfo.h>
  43 #include <stdlib.h>
  44 #include <wchar.h>
  45 #include <sys/types.h>
  46 #include <sys/debug.h>
  47 #include <libcmdutils.h>
  48 
  49 #include "libbe.h"
  50 


 197                 if (first) {
 198                         (void) printf("%-*s", width, name);
 199                         first = B_FALSE;
 200                 } else
 201                         (void) printf(" %-*s", width, name);
 202         }
 203         (void) putchar('\n');
 204 }
 205 
 206 static void
 207 init_hdr_cols(enum be_fmt be_fmt, struct hdr_info *hdr)
 208 {
 209         struct col_info *col = hdr->cols;
 210         size_t i;
 211 
 212         col[1].col_name = _("Active");
 213         col[2].col_name = _("Mountpoint");
 214         col[3].col_name = _("Space");
 215         col[4].col_name = _("Policy");
 216         col[5].col_name = _("Created");

 217 
 218         switch (be_fmt) {
 219         case BE_FMT_ALL:
 220                 col[0].col_name = _("BE/Dataset/Snapshot");
 221                 break;
 222         case BE_FMT_DATASET:
 223                 col[0].col_name = _("BE/Dataset");
 224                 break;
 225         case BE_FMT_SNAPSHOT:
 226                 col[0].col_name = _("BE/Snapshot");
 227                 col[1].col_name = NULL;
 228                 col[2].col_name = NULL;
 229                 break;
 230         case BE_FMT_DEFAULT:
 231         default:
 232                 col[0].col_name = _("BE");
 233         }
 234 
 235         for (i = 0; i < NUM_COLS; i++) {
 236                 const char *name = col[i].col_name;