• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

system/corennnnn


Commit MetaInfo

Revisiónbc7b0cbe156da639f0cbe17bf89725d87e86512a (tree)
Tiempo2008-11-16 22:28:23
AutorJay Freeman (saurik) <saurik@saur...>
CommiterJay Freeman (saurik)

Log Message

Open file and loop device with O_RDONLY when -o loop,ro.
Otherwise: ioctl LOOP_SET_FD failed: Bad file number.

Cambiar Resumen

Diferencia incremental

--- a/toolbox/mount.c
+++ b/toolbox/mount.c
@@ -138,14 +138,17 @@ do_mount(char *dev, char *dir, char *type, unsigned long rwflag, void *data, int
138138
139139 if (loop) {
140140 int file_fd, device_fd;
141+ int flags;
142+
143+ flags = (rwflag & MS_RDONLY) ? O_RDONLY : O_RDWR;
141144
142145 // FIXME - only one loop mount supported at a time
143- file_fd = open(dev, O_RDWR);
146+ file_fd = open(dev, flags);
144147 if (file_fd < -1) {
145148 perror("open backing file failed");
146149 return 1;
147150 }
148- device_fd = open(LOOP_DEVICE, O_RDWR);
151+ device_fd = open(LOOP_DEVICE, flags);
149152 if (device_fd < -1) {
150153 perror("open loop device failed");
151154 close(file_fd);