Storage_OpenFileInImagePackage Function

Header: #include <applibs/storage.h>

Takes a relative path inside the image package and returns an opened read-only file descriptor. The caller should close the returned file descriptor with the close function. This function should only be used to open regular files inside the image package.

int Storage_OpenFileInImagePackage(const char *relativePath);

Parameters

  • relativePath A relative path from the root of the image package. This value must not start with the directory separator character '/'.

Errors

Returns -1 if an error is encountered and sets errno to the error value.

  • EINVAL: relativePath begins with '/' or '.', or contains '..'.

  • EFAULT: relativePath is NULL.

  • ENOMEM: Out of memory.

Any other errno may also be specified; such errors aren't deterministic and the same behavior might not be retained through system updates.

Return value

Returns the opened file descriptor, or -1 for failure, in which case errno is set to the error value.

Concepts and samples