HDFS-711. hdfsUtime does not handle atime = 0 or mtime = 0 correctly. Contributed by Colin Patrick McCabe

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1358811 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Eli Collins 2012-07-08 18:29:17 +00:00
parent 7dcf9b6b8f
commit 9f79f45b8c
3 changed files with 8 additions and 4 deletions

View File

@ -274,6 +274,9 @@ Release 2.0.1-alpha - UNRELEASED
HDFS-3603. Decouple TestHDFSTrash from TestTrash. (Jason Lowe via eli)
HDFS-711. hdfsUtime does not handle atime = 0 or mtime = 0 correctly.
(Colin Patrick McCabe via eli)
BREAKDOWN OF HDFS-3042 SUBTASKS
HDFS-2185. HDFS portion of ZK-based FailoverController (todd)

View File

@ -1710,8 +1710,9 @@ int hdfsUtime(hdfsFS fs, const char* path, tTime mtime, tTime atime)
return -2;
}
jlong jmtime = mtime * (jlong)1000;
jlong jatime = atime * (jlong)1000;
const tTime NO_CHANGE = -1;
jlong jmtime = (mtime == NO_CHANGE) ? -1 : (mtime * (jlong)1000);
jlong jatime = (atime == NO_CHANGE) ? -1 : (atime * (jlong)1000);
int ret = 0;
jthrowable jExc = NULL;

View File

@ -468,8 +468,8 @@ extern "C" {
* hdfsUtime
* @param fs The configured filesystem handle.
* @param path the path to the file or directory
* @param mtime new modification time or 0 for only set access time in seconds
* @param atime new access time or 0 for only set modification time in seconds
* @param mtime new modification time or -1 for no change
* @param atime new access time or -1 for no change
* @return 0 on success else -1
*/
int hdfsUtime(hdfsFS fs, const char* path, tTime mtime, tTime atime);