src/filed/fd_snapshot.c
int edit_snapshot_env() {
      int      i   = 0;
      POOLMEM *tmp = get_pool_memory(PM_FNAME);
      free_env();

      /* Update "10" to add more variables */
      env = (char **) malloc(sizeof(char *) * 10);

      if (*Name) {
         Mmsg(tmp, "SNAPSHOT_NAME=%s", Name);
         env[i++] = bstrdup(tmp);
      }
      if (*Volume) {
         Mmsg(tmp, "SNAPSHOT_VOLUME=%s", Volume);
         env[i++] = bstrdup(tmp);
      }
      if (*Device) {
         Mmsg(tmp, "SNAPSHOT_DEVICE=%s", Device);
         env[i++] = bstrdup(tmp);
      }
      if (*Type) {
         Mmsg(tmp, "SNAPSHOT_TYPE=%s", Type);
         env[i++] = bstrdup(tmp);
      }
      if (*FSType) {
         Mmsg(tmp, "SNAPSHOT_FSTYPE=%s", FSType);
         env[i++] = bstrdup(tmp);
      }
      if (*MountPoint) {
         Mmsg(tmp, "SNAPSHOT_MOUNTPOINT=%s", MountPoint);
         env[i++] = bstrdup(tmp);
      }
      if (*SnapDirectory) {
         Mmsg(tmp, "SNAPSHOT_SNAPDIRECTORY=%s", SnapDirectory);
         env[i++] = bstrdup(tmp);
      }
      if (*SnapMountPoint) {
         Mmsg(tmp, "SNAPSHOT_SNAPMOUNTPOINT=%s", SnapMountPoint);
         env[i++] = bstrdup(tmp);
      }
      /* When adding new entries, do not forget to add more slots to env[] */

      Mmsg(tmp, "SNAPSHOT_ACTION=%s", action);
      env[i++] = bstrdup(tmp);

      env[i] = NULL;            /* last record */

      if (chk_dbglvl(DT_SNAPSHOT|100)) {
         for (i = 0; env[i] ; i++) {
            Dmsg1(0, "%s\n", env[i]);
         }
      }

      free_pool_memory(tmp);
      return 1;
   }
/* Create a environment used in the child process */
Create a environment used in the child process
Create a environment used in the child process
int edit_snapshot_env() {
      int      i   = 0;
      POOLMEM *tmp = get_pool_memory(PM_FNAME);
      free_env();
      env = (char **) malloc(sizeof(char *) * 10);
      if (*Name) {
         Mmsg(tmp, "SNAPSHOT_NAME=%s", Name);
         env[i++] = bstrdup(tmp);
      }
      if (*Volume) {
         Mmsg(tmp, "SNAPSHOT_VOLUME=%s", Volume);
         env[i++] = bstrdup(tmp);
      }
      if (*Device) {
         Mmsg(tmp, "SNAPSHOT_DEVICE=%s", Device);
         env[i++] = bstrdup(tmp);
      }
      if (*Type) {
         Mmsg(tmp, "SNAPSHOT_TYPE=%s", Type);
         env[i++] = bstrdup(tmp);
      }
      if (*FSType) {
         Mmsg(tmp, "SNAPSHOT_FSTYPE=%s", FSType);
         env[i++] = bstrdup(tmp);
      }
      if (*MountPoint) {
         Mmsg(tmp, "SNAPSHOT_MOUNTPOINT=%s", MountPoint);
         env[i++] = bstrdup(tmp);
      }
      if (*SnapDirectory) {
         Mmsg(tmp, "SNAPSHOT_SNAPDIRECTORY=%s", SnapDirectory);
         env[i++] = bstrdup(tmp);
      }
      if (*SnapMountPoint) {
         Mmsg(tmp, "SNAPSHOT_SNAPMOUNTPOINT=%s", SnapMountPoint);
         env[i++] = bstrdup(tmp);
      }
      Mmsg(tmp, "SNAPSHOT_ACTION=%s", action);
      env[i++] = bstrdup(tmp);
      env[i] = NULL;            
      if (chk_dbglvl(DT_SNAPSHOT|100)) {
         for (i = 0; env[i] ; i++) {
            Dmsg1(0, "%s\n", env[i]);
         }
      }
      free_pool_memory(tmp);
      return 1;
   }
int edit_snapshot_env ( ) { int i = 0 ; POOLMEM * tmp = get_pool_memory ( PM_FNAME ) ; free_env ( ) ; env = ( char * * ) malloc ( sizeof ( char * ) * 10 ) ; if ( * Name ) { Mmsg ( tmp , " " , Name ) ; env [ i ++ ] = bstrdup ( tmp ) ; } if ( * Volume ) { Mmsg ( tmp , " " , Volume ) ; env [ i ++ ] = bstrdup ( tmp ) ; } if ( * Device ) { Mmsg ( tmp , " " , Device ) ; env [ i ++ ] = bstrdup ( tmp ) ; } if ( * Type ) { Mmsg ( tmp , " " , Type ) ; env [ i ++ ] = bstrdup ( tmp ) ; } if ( * FSType ) { Mmsg ( tmp , " " , FSType ) ; env [ i ++ ] = bstrdup ( tmp ) ; } if ( * MountPoint ) { Mmsg ( tmp , " " , MountPoint ) ; env [ i ++ ] = bstrdup ( tmp ) ; } if ( * SnapDirectory ) { Mmsg ( tmp , " " , SnapDirectory ) ; env [ i ++ ] = bstrdup ( tmp ) ; } if ( * SnapMountPoint ) { Mmsg ( tmp , " " , SnapMountPoint ) ; env [ i ++ ] = bstrdup ( tmp ) ; } Mmsg ( tmp , " " , action ) ; env [ i ++ ] = bstrdup ( tmp ) ; env [ i ] = NULL ; if ( chk_dbglvl ( DT_SNAPSHOT | 100 ) ) { for ( i = 0 ; env [ i ] ; i ++ ) { Dmsg1 ( 0 , " \n " , env [ i ] ) ; } } free_pool_memory ( tmp ) ; return 1 ; }
Create a environment used in the child process
Create a environment used in the child process
/* Update "10" to add more variables */ /* When adding new entries, do not forget to add more slots to env[] */ /* last record */