Whamcloud - gitweb
debugfs: fix string_to_time for MacOS strptime()
authorAndreas Dilger <adilger@dilger.ca>
Tue, 20 May 2014 22:31:10 +0000 (16:31 -0600)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 22 May 2014 21:52:23 +0000 (17:52 -0400)
commit90c5b4c9de8ea43e0994cc3a07cdc4c4c777623c
tree80aebfeef102f1ed563568731cac174e787a7491
parenta7b0f770b0f3f058ff1682beba5a78def91e91a7
debugfs: fix string_to_time for MacOS strptime()

The strptime() function does not update fields in struct tm that are
not specified in the input format.  The glibc implementation sets the
tm_yday field (%j) when any of the year (%Y), month (%m), or day (%d)
fields are changed, but the MacOS strptime() does not set tm_yday in
this case.  This caused string_to_time() to calculate the wrong Unix
epoch on MacOS. If tm_yday is unset, compute it in string_to_time().

This also fixes test regression failures for FreeBSD.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
debugfs/util.c
tests/f_dup_resize/script
tests/f_uninit_last_uninit/script