getcwd syscall fails on 3rd subfolder
Hoefle Marco
Marco.Hoefle at nanotronic.ch
Tue Apr 8 12:22:14 UTC 2014
Hello,
we use the Gaisler RTEMS Kernel 4-10-1.2.14 on a GR712RC board.
The following function is used to determine the current working directory on a fatfs:
static NtsError fs_pwd_do( int argc, char **argv)
{
char *ret = getcwd(NULL, 0);
if(ret) {
nts_printf("%s\n", ret);
free(ret);
return NTS_OK;
}
nts_printf("getcwd failed, errno: %d, MAXPATHLEN: %d\n", errno, MAXPATHLEN);
return NTS_FAILURE;
}
The fatfs was generated using:
@dd if=/dev/zero of=$(NAME) bs=256 count=1024 > /dev/null
/sbin/mkfs.vfat -F 12 -S 512 -s 1 -r 512 -f 1 -v $(NAME)
This is what happens:
cassis> fs mount
RAM Disk registered
mount return: 0
ram disk addr: 0x64000000
cassis> fs ls
3920 dev
16384 mnt
cassis> fs pwd
/
cassis> fs cwd mnt
changed to mnt
cassis> fs pwd
/mnt
cassis> fs ls
512 template
cassis> fs cwd template
changed to template
cassis> fs pwd
/mnt/template
cassis>
cassis> fs ls
512 .
16384 ..
512 param
512 logs
cassis> fs cwd logs
changed to logs
cassis> fs pwd
getcwd failed, errno: 2, MAXPATHLEN: 1024
cassis>
The folder logs is definitely existing:
cassis> fs dump /mnt/template/logs/housekeeping/log0
file size: 10
64 61 63 30 3a 20 31 30 30 0a
A non existing file leeds to:
cassis> fs dump /mnt/template/logs/housekeeping/log9
file size: 10
failure, ret: -1, errno: 2
Has anybody an idea why getcwd() fails (errno 2 means not existent)?
Cheers,
Marco
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20140408/34330438/attachment.html>
More information about the users
mailing list