On Thu, 2019-08-08 at 03:16 +0000, Justin Hibbits wrote:
> Author: jhibbits
> Date: Thu Aug  8 03:16:32 2019
> New Revision: 350737
> URL: https://svnweb.freebsd.org/changeset/base/350737
> 
> Log:
>   Change autounmountd(8) to use time_t for duration instead of double
>   
>   Summary:
>   autounmountd(8) uses doubles to handle mount time durations.  However,
>   it must convert to integer types, time_t in particular, to do anything
>   meaningful.  Additionally, even though it's a floating-point value in
>   seconds, the sub-seconds component is never used, so it's unnecessary.
>   
>   Switching type to time_t fixes an assertion on powerpc64, which checks
>   that a sleep value that's not -1.0 is greater than 0.  On powerpc64, it
>   happens that the value of -1.0 gets loaded as a float (perhaps a bug in
>   gcc), but gets compared to a double.  This compares as false, so follows
>   through the 'sleep != -1.0' path, and fails the assert.  Since the
>   sub-second component isn't used in the double, just drop it and deal
>   with whole-integer seconds.
>   
>   Reviewed by:        trasz
>   Differential Revision: https://reviews.freebsd.org/D21109
> 
> Modified:
>   head/usr.sbin/autofs/autounmountd.c
> 
> Modified: head/usr.sbin/autofs/autounmountd.c
> ==============================================================================
> --- head/usr.sbin/autofs/autounmountd.c       Thu Aug  8 03:01:35 2019        
> (r350736)
> +++ head/usr.sbin/autofs/autounmountd.c       Thu Aug  8 03:16:32 2019        
> (r350737)
> @@ -179,12 +179,12 @@ unmount_by_fsid(const fsid_t fsid, const char *mountpo
>       return (error);
>  }
>  
> -static double
> -expire_automounted(double expiration_time)
> +static time_t
> +expire_automounted(time_t expiration_time)
>  {
>       struct automounted_fs *af, *tmpaf;
>       time_t now;
> -     double mounted_for, mounted_max = -1.0;
> +     time_t mounted_for, mounted_max = -1;
>       int error;
>  
>       now = time(NULL);
> @@ -196,9 +196,9 @@ expire_automounted(double expiration_time)
>  
>               if (mounted_for < expiration_time) {
>                       log_debugx("skipping %s (FSID:%d:%d), mounted "
> -                         "for %.0f seconds", af->af_mountpoint,
> +                         "for %ld  seconds", af->af_mountpoint,

You can't print a time_t with %ld, it'll fail on 32-bit arches with 64-
bit time_t.  The usual incantation is %j and cast to intmax_t.

-- Ian


_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to