bug-parted
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[patch] libparted/device_gnu.c: bug and cleanup


From: Neal H Walfield
Subject: [patch] libparted/device_gnu.c: bug and cleanup
Date: Tue, 14 Aug 2001 11:00:25 +0200
User-agent: Mutt/1.3.18i

When opening a store, we should use store_typed_open, not store_open.
Additionally, _arch_device_open is a bit inelegant; it is nicer to save
the error code and not a reference to a string.

A change log:

2001-08-14  Neal H Walfield  <address@hidden>

        * libparted/device_gnu.c (_arch_device_open): Call
        store_typed_open, not store_open.
        Do save the error message, save the error code.

diff --exclude aclocal.m4 --exclude configure --exclude Makefile.in -urNp 
parted-1.5.4-pre1.orig/libparted/device_gnu.c 
parted-1.5.4-pre1/libparted/device_gnu.c
--- parted-1.5.4-pre1.orig/libparted/device_gnu.c       Sun Aug 12 05:35:23 2001
+++ parted-1.5.4-pre1/libparted/device_gnu.c    Tue Aug 14 09:41:33 2001
@@ -209,16 +255,15 @@ int
 _arch_device_open (PedDevice* dev)
 {
        GNUSpecific*    arch_specific = GNU_SPECIFIC (dev);
-       error_t err;
-       char*           rw_error_msg;
+       error_t err, rw_err;
 
 retry:
-       err = store_open (dev->path, 0, NULL, &arch_specific->store);
+       err = store_typed_open (dev->path, 0, NULL, &arch_specific->store);
        if (err) {
-               rw_error_msg = strerror (err);
+               rw_err = err;
 
-               err = store_open (dev->path, STORE_READONLY, NULL,
-                                 &arch_specific->store);
+               err = store_typed_open (dev->path, STORE_READONLY, NULL,
+                                       &arch_specific->store);
                if (err) {
                        if (ped_exception_throw (
                                PED_EXCEPTION_ERROR,
@@ -235,7 +280,7 @@ retry:
                                PED_EXCEPTION_OK,
                                _("Unable to open %s read-write (%s).  %s has "
                                  "been opened read-only."),
-                               dev->path, rw_error_msg, dev->path);
+                               dev->path, strerror (rw_err), dev->path);
                        dev->read_only = 1;
                }
        } else {

Attachment: pgpxjMp5guvz0.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]