Author: mcayland Date: Sun Jul 11 21:40:18 2010 New Revision: 818 URL: http://tracker.coreboot.org/trac/openbios/changeset/818
Log: Fix bug in dir path parsing on HFS filesystems.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@siriusit.co.uk
Modified: trunk/openbios-devel/fs/hfs/hfs_fs.c
Modified: trunk/openbios-devel/fs/hfs/hfs_fs.c ============================================================================== --- trunk/openbios-devel/fs/hfs/hfs_fs.c Sun Jul 11 20:57:19 2010 (r817) +++ trunk/openbios-devel/fs/hfs/hfs_fs.c Sun Jul 11 21:40:18 2010 (r818) @@ -492,8 +492,7 @@ hfsvol *volume; hfscommon *common; hfsdirent ent; - const char *s; - char buf[256], *tmppath; + int i; int fd;
ihandle_t ih = POP(); @@ -512,36 +511,12 @@
common = malloc(sizeof(hfscommon));
- if (strcmp(path, "\") == 0) { - common->dir = hfs_opendir(volume, ":"); - } else { - if (path[strlen(path) - 1] == '\') { - path[strlen(path) - 1] = 0; - } - - tmppath = path; - for( tmppath-- ;; ) { - int n; - - s = ++tmppath; - tmppath = strchr(s, '\'); - if( !tmppath || !tmppath[1]) - break; - n = MIN( sizeof(buf)-1, (path-s) ); - if( !n ) - continue; - - strncpy( buf, s, n ); - buf[n] = 0; - if( hfs_chdir(volume, buf) ) { - free(common); - free(path); - return; - } - } + /* HFS paths are colon separated, not backslash separated */ + for (i = 0; i < strlen(path); i++) + if (path[i] == '\') + path[i] = ':';
- common->dir = hfs_opendir(volume, s); - } + common->dir = hfs_opendir(volume, path);
forth_printf("\n"); while( !hfs_readdir(common->dir, &ent) ) {