Read /etc/fstab file size

Questions and Answers about all things *OS (macOS, iOS, tvOS, watchOS)

Read /etc/fstab file size

Postby elayos » Sat Dec 22, 2018 7:05 pm

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?
Thanks!
elayos
 
Posts: 3
Joined: Mon Oct 22, 2018 7:39 pm

Re: Read /etc/fstab file size

Postby morpheus » Fri Dec 28, 2018 9:38 am

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.
morpheus
Site Admin
 
Posts: 731
Joined: Thu Apr 11, 2013 6:24 pm

Re: Read /etc/fstab file size

Postby elayos » Fri Dec 28, 2018 3:35 pm

Hi,

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.
elayos
 
Posts: 3
Joined: Mon Oct 22, 2018 7:39 pm


Return to Questions and Answers

Who is online

Users browsing this forum: ccnut and 2 guests