[BACK]Return to timeout.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / timeout

Diff for /src/usr.bin/timeout/timeout.c between version 1.10 and 1.11

version 1.10, 2021/09/01 20:18:54 version 1.11, 2021/09/01 21:43:51
Line 1 
Line 1 
 /* $OpenBSD$ */  /* $OpenBSD$ */
   
 /*-  /*
  * Copyright (c) 2021 Job Snijders <job@openbsd.org>   * Copyright (c) 2021 Job Snijders <job@openbsd.org>
  * Copyright (c) 2014 Baptiste Daroussin <bapt@FreeBSD.org>   * Copyright (c) 2014 Baptiste Daroussin <bapt@FreeBSD.org>
  * Copyright (c) 2014 Vsevolod Stakhov <vsevolod@FreeBSD.org>   * Copyright (c) 2014 Vsevolod Stakhov <vsevolod@FreeBSD.org>
Line 63 
Line 63 
 parse_duration(const char *duration)  parse_duration(const char *duration)
 {  {
         double   ret;          double   ret;
         char    *end;          char    *suffix;
   
         ret = strtod(duration, &end);          ret = strtod(duration, &suffix);
         if (ret == 0 && end == duration)          if (ret == 0 && suffix == duration)
                 err(1, "invalid duration");                  err(1, "invalid duration");
           if (ret < 0 || ret >= 100000000UL)
                   err(1, "invalid duration");
   
         if (end == NULL || *end == '\0')          if (suffix == NULL || *suffix == '\0')
                 return (ret);                  return (ret);
   
         if (end != NULL && *(end + 1) != '\0')          if (suffix != NULL && *(suffix + 1) != '\0')
                 err(1, "invalid duration");                  err(1, "invalid duration");
   
         switch (*end) {          switch (*suffix) {
         case 's':          case 's':
                 break;                  break;
         case 'm':          case 'm':
Line 90 
Line 92 
         default:          default:
                 err(1, "invalid duration");                  err(1, "invalid duration");
         }          }
   
         if (ret < 0 || ret >= 100000000UL)  
                 err(1, "invalid duration");  
   
         return (ret);          return (ret);
 }  }

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11