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/trunk@1358810 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Eli Collins 2012-07-08 18:29:00 +00:00
parent 9bebba6605
commit 52f5c70330
3 changed files with 8 additions and 4 deletions

View File

@ -425,6 +425,9 @@ Branch-2 ( Unreleased changes )
HDFS-3603. Decouple TestHDFSTrash from TestTrash. (Jason Lowe via eli) 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 BREAKDOWN OF HDFS-3042 SUBTASKS
HDFS-2185. HDFS portion of ZK-based FailoverController (todd) 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; return -2;
} }
jlong jmtime = mtime * (jlong)1000; const tTime NO_CHANGE = -1;
jlong jatime = atime * (jlong)1000; jlong jmtime = (mtime == NO_CHANGE) ? -1 : (mtime * (jlong)1000);
jlong jatime = (atime == NO_CHANGE) ? -1 : (atime * (jlong)1000);
int ret = 0; int ret = 0;
jthrowable jExc = NULL; jthrowable jExc = NULL;

View File

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