summaryrefslogtreecommitdiffstats
path: root/cpukit/libcsupport/src/utime.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2010-07-01 16:29:17 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2010-07-01 16:29:17 +0000
commitcfcdb5b218a3ff87465d2b15d45be060683ed8d3 (patch)
tree43570ecc192a305f167e05eebe103dfe8f40f884 /cpukit/libcsupport/src/utime.c
parent2010-07-01 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-cfcdb5b218a3ff87465d2b15d45be060683ed8d3.tar.bz2
2010-07-01 Vinu Rajashekhar <vinutheraj@gmail.com>
PR 1529/cpukit * utime.c: Change file access time and modified time to current time if pointer to struct utimbuf is NULL. * imfs_utime.c: Upon successful completion, imfs_utime() marks the time of the last file status change, st_ctime, to be updated.
Diffstat (limited to 'cpukit/libcsupport/src/utime.c')
-rw-r--r--cpukit/libcsupport/src/utime.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/cpukit/libcsupport/src/utime.c b/cpukit/libcsupport/src/utime.c
index 6cceea719f..b6f1954dae 100644
--- a/cpukit/libcsupport/src/utime.c
+++ b/cpukit/libcsupport/src/utime.c
@@ -29,6 +29,7 @@ int utime(
{
rtems_filesystem_location_info_t temp_loc;
int result;
+ struct utimbuf now;
if ( rtems_filesystem_evaluate_path( path, strlen( path ), 0x00, &temp_loc, true ) )
return -1;
@@ -38,6 +39,11 @@ int utime(
rtems_set_errno_and_return_minus_one( ENOTSUP );
}
+ if ( times == NULL ) {
+ now.actime = now.modtime = time( NULL );
+ times = &now;
+ }
+
result = (*temp_loc.ops->utime_h)( &temp_loc, times->actime, times->modtime );
rtems_filesystem_freenode( &temp_loc );