Fix a bug introduced in r323.
authorpixdamix <pixdamix@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>
Wed, 18 Nov 2009 16:02:23 +0000 (16:02 +0000)
committerpixdamix <pixdamix@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>
Wed, 18 Nov 2009 16:02:23 +0000 (16:02 +0000)
fdopen(fd, "rw") can cause a bad file descriptor error.

git-svn-id: http://opkg.googlecode.com/svn/trunk@333 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

libopkg/pkg.c

index 5d705c7bb147c0d436ff611a61c4deb57821b434..f73cf5c8a9ba9f286fbdf74acf8aa2381cd43a21 100644 (file)
@@ -334,7 +334,7 @@ pkg_init_from_file(pkg_t *pkg, const char *filename)
                goto err0;
        }
 
-       control_file = fdopen(fd, "rw");
+       control_file = fdopen(fd, "rw+");
        if (control_file == NULL) {
                perror_msg("%s: fdopen", __FUNCTION__, control_path);
                close(fd);