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 5d705c7..f73cf5c 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);