Page 1 of 1

Read /etc/fstab file size

PostPosted: Sat Dec 22, 2018 7:05 pm
by elayos
Hi all,

I tried to read /etc/fstab file size and I got an operation not permitted error. I'm guessing I need a special entitlement for it or I wrong?

The Error:
Failed to fetching /etc/fstab file size. Error Domain=NSCocoaErrorDomain Code=257 "The file “fstab” couldn’t be opened because you don’t have permission to view it." UserInfo={NSFilePath=/etc/fstab, NSUnderlyingError=0x1c40579a0 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}}

Any advice?

Re: Read /etc/fstab file size

PostPosted: Fri Dec 28, 2018 9:38 am
by morpheus
No entitlement, but could be sandbox or other issue. Use the lower level syscalls of access (...R_OK) and stat(2), rather than the higher level which may use fstat(2) instead - that requires you to open the file to get its size. If access(2) fails, the sandbox is preventing you, because as far as I remember /etc/fstab should be readable. There's an off chance that /etc/fstab just isn't there.

Re: Read /etc/fstab file size

PostPosted: Fri Dec 28, 2018 3:35 pm
by elayos

So... it's a sandbox issue.
Sorry for the noob question, but it is possible to install an application (on my own NON-jailbroken device) outside /var/mobile/Containers directory to access this file?

Thanks for the response.