#4 ✓resolved
Matt Colyer

ifuse_open doesn't handle file modes correctly

Reported by Matt Colyer | March 24th, 2009 @ 03:22 AM | in 1.0 Release

ifuse_open() needs call something along the lines of:


int afc_mode_from_posix_mode(long long *afc_mode, const mode_t mode);
{
  int i, result = -1;
  const mode_t allowed_modes[7] = {
    O_RDONLY,
    O_RDONLY,
    O_RDWR | O_CREAT,
    O_WRONLY | O_CREAT | O_TRUNC,
    O_RDWR | O_CREAT | O_TRUNC,
    O_WRONLY | O_APPEND | O_CREAT,
    O_RDWR | O_APPEND | O_CREAT
  };
  for(i = 0; i < 7; i++)
    if(mode == allowed_modes[i]) {
      *afc_mode = (long long)i;
      result = 0;
      break;
    }
  return result;
}

ifuse_open(...)
{
  ...
  if (afc_mode_from_posix_mode(&mode, fi->flags & 0xSOMETHING)
    return EPERM;
  else
    iphone_afc_open_file(afc, path, mode, &file);
    ...
}

instead of the present three-case if..else.

nb. (untested, undebugged, puesudo code); if nobody else makes it into something working, I'll do that tonight/tomorrow.

-Paul

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

A project around supporting the iPhone in Linux.

See http://libimobiledevice.org

People watching this ticket

Referenced by

Pages