Changeset 934
- Timestamp:
- 01/29/12 18:38:29 (17 months ago)
- Location:
- trunk
- Files:
-
- 2 edited
-
CHDK/SCRIPTS/TEST/llibtst.lua (modified) (2 diffs)
-
platform/generic/wrappers.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/CHDK/SCRIPTS/TEST/llibtst.lua
r5 r934 366 366 end 367 367 368 function tstat(name )368 function tstat(name,expect) 369 369 log('os.stat("',tostring(name),'"): ') 370 370 local r,msg = os.stat(name) 371 371 if r then 372 local fail 373 if type(expect) == 'table' then 374 for k,v in pairs(expect) do 375 -- special case, dryos >= R39 doesn't set atime 376 if r[k] ~= v and not (k == 'atime' and r[k] == nil) then 377 logfail("expected "..tostring(k).."="..tostring(v).." not "..tostring(r[k])) 378 fail = true 379 end 380 end 381 end 382 if not fail then 383 logok() 384 end 372 385 -- local keys={ "dev", "ino", "mode", "nlink", "uid", "gid", "rdev", "size", "atime", "mtime", "ctime", "blksize", "blocks", "attrib", "reserved1", "reserved2", "reserved3", "reserved4", "reserved5", "reserved6",} 373 386 local keys={ "dev", "mode", "size", "atime", "mtime", "ctime", "blksize", "blocks", "attrib","is_dir","is_file",} 374 logok()375 387 log("{\n") 376 388 for _,v in ipairs(keys) do … … 443 455 tf:close() 444 456 local fn=tdir0..tdat0 445 tstat(fn )457 tstat(fn,{is_file=true,is_dir=false}) 446 458 tutime(fn) -- utime, current 447 459 tstat(fn) 448 tutime(fn,os.time({year=1984,month=1,day=1 }),os.time({year=1984,month=12,day=25}))449 tstat(fn )450 tstat(tdir0 )460 tutime(fn,os.time({year=1984,month=1,day=1,hour=0}),os.time({year=1984,month=12,day=25,hour=0})) 461 tstat(fn,{mtime=os.time({year=1984,month=1,day=1,hour=0}),atime=os.time({year=1984,month=12,day=25,hour=0})}) 462 tstat(tdir0,{is_file=false,is_dir=true}) 451 463 tren(tdir0..tdat0,tdir0..tdat1) 452 464 tlistdir(tdir0) -
trunk/platform/generic/wrappers.c
r933 r934 577 577 578 578 #ifdef CAM_DRYOS_2_3_R39 579 if (fd>=0) {580 _close(fd);581 res=_SetFileTimeStamp(file, ((int*)newTimes)[0] , ((int*)newTimes)[1]);582 }583 #else 584 if (fd>=0) {585 res=_SetFileTimeStamp(fd, ((int*)newTimes)[0] , ((int*)newTimes)[1]);586 _close(fd);587 }588 // return value compatibe with utime: ok=0 fail=-1579 if (fd>=0) { 580 _close(fd); 581 res=_SetFileTimeStamp(file, newTimes->modtime, newTimes->actime); 582 } 583 #else 584 if (fd>=0) { 585 res=_SetFileTimeStamp(fd, newTimes->modtime, newTimes->actime); 586 _close(fd); 587 } 588 // return value compatibe with utime: ok=0 fail=-1 589 589 #endif 590 590 return (res)?0:-1;
Note: See TracChangeset
for help on using the changeset viewer.