bug-parted
[Top][All Lists]
Advanced

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

Patch for GNU/Hurd.


From: Harley D. Eades III
Subject: Patch for GNU/Hurd.
Date: Sun, 23 May 2004 07:52:56 -0500
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040122 Debian/1.6-1

Hi,
I have been investigating a problem with parted on GNU/Hurd. The problem was a simple one, when a user supplied a path parted would segfault. It works fine if you use the TYPE:NAME syntax. The problem was you strictly use store_typed_open which only allows the TYPE:NAME syntax. I added a small check to see if the user supplies a path or the TYPE:NAME syntax. If it is a path use the store_open function, if it is TYPE:NAME use store_typed_open. You will notice in the patch all I do is check to see if there is a '/' in path. This might not be as sexy of a check feel free to change it. This is just a simple fix.
Thanks for your time.  The patch is attached.

Cheers
Harley D. Eades III

P.S. This patch is for parted-1.6.6 but I noticed that this bug is also in 6.11. Also if you have any questions please reply to this address since I am not on your
       mailing list.
--- parted-1.6.6/libparted/gnu.c        2003-06-25 22:57:34.000000000 -0500
+++ hurd_parted-1.6.6/libparted/gnu.c   2004-05-23 06:58:12.000000000 -0500
@@ -235,7 +235,16 @@
        arch_specific->consume = 1;
 
  retry_open:
-       err = store_typed_open (dev->path, 0, NULL, &arch_specific->store);
+       /* Simple test to determine if the user uses a path or TYPE:NAME. */
+       if (strchrnul (path, '/') != '\0')
+         {
+           err = store_open (dev->path, 0, NULL, &arch_specific->store); 
+         }
+       else
+         {
+           err = store_typed_open (dev->path, 0, NULL, &arch_specific->store);
+         }
+
        if (err) {
                error_t rw_err = err;
 

reply via email to

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