src/filed/fd_snapshot.c
static bool is_snapshot_supported(JCR *jcr)
{
   bool ret;
   struct stat sp;
   POOLMEM    *cmd = get_pool_memory(PM_FNAME);
   const char *p;
   const char *str;
   char add[20];

   /* We are not really interested by arguments, just
    * the filename
    */
   *cmd = 0;
   for (p=me->snapshot_command; *p; p++) {
      if (*p == '%') {
         switch (*++p) {
         case '%':
            str = "%";
            break;
         case 'e':
            str = NPRTB(exepath);
            break;
         default:
            add[0] = '%';
            add[1] = *p;
            add[2] = 0;
            str = add;
         }

      } else if (*p == ' ') {
         break;

      } else {
         add[0] = *p;
         add[1] = 0;
         str = add;
      }
      pm_strcat(cmd, str);
   }

   ret = stat(cmd, &sp) == 0;
   free_pool_memory(cmd);
   Dmsg1(10, "Snapshot = %d\n", ret);
   return ret;
}
/* Small function to quickly tell us if we can do snapshot here */
Small function to quickly tell us if we can do snapshot here
Small function to quickly tell us if we can do snapshot here
static bool is_snapshot_supported(JCR *jcr)
{
   bool ret;
   struct stat sp;
   POOLMEM    *cmd = get_pool_memory(PM_FNAME);
   const char *p;
   const char *str;
   char add[20];
   *cmd = 0;
   for (p=me->snapshot_command; *p; p++) {
      if (*p == '%') {
         switch (*++p) {
         case '%':
            str = "%";
            break;
         case 'e':
            str = NPRTB(exepath);
            break;
         default:
            add[0] = '%';
            add[1] = *p;
            add[2] = 0;
            str = add;
         }
      } else if (*p == ' ') {
         break;
      } else {
         add[0] = *p;
         add[1] = 0;
         str = add;
      }
      pm_strcat(cmd, str);
   }
   ret = stat(cmd, &sp) == 0;
   free_pool_memory(cmd);
   Dmsg1(10, "Snapshot = %d\n", ret);
   return ret;
}
static bool is_snapshot_supported ( JCR * jcr ) { bool ret ; struct stat sp ; POOLMEM * cmd = get_pool_memory ( PM_FNAME ) ; const char * p ; const char * str ; char add [ 20 ] ; * cmd = 0 ; for ( p = me -> snapshot_command ; * p ; p ++ ) { if ( * p == ' ' ) { switch ( * ++ p ) { case ' ' : str = " " ; break ; case ' ' : str = NPRTB ( exepath ) ; break ; default : add [ 0 ] = ' ' ; add [ 1 ] = * p ; add [ 2 ] = 0 ; str = add ; } } else if ( * p == ' ' ) { break ; } else { add [ 0 ] = * p ; add [ 1 ] = 0 ; str = add ; } pm_strcat ( cmd , str ) ; } ret = stat ( cmd , & sp ) == 0 ; free_pool_memory ( cmd ) ; Dmsg1 ( 10 , " \n " , ret ) ; return ret ; }
Small function to quickly tell us if we can do snapshot here
Small function to quickly tell us if we can do snapshot here
/* We are not really interested by arguments, just
    * the filename
    */