[PATCH] Revert "Avoid string duplication calling dirname()"

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

 



Because dirname() may modify the path. See:

http://www.kernel.org/doc/man-pages/online/pages/man3/dirname.3.html

This fixes a segfault found while manually testing grubby on RHEL 5.

This reverts commit 54ff9d923f1dd90dde81e0e90e9448fdc52044c4.

Signed-off-by: Cleber Rosa <crosa@xxxxxxxxxx>
---
 grubby.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/grubby.c b/grubby.c
index 3c93729..afc90a6 100644
--- a/grubby.c
+++ b/grubby.c
@@ -1309,7 +1309,7 @@ static int writeConfig(struct grubConfig * cfg, char * outName,
 
 	    /* most likely the symlink is relative, so change our
 	       directory to the dir of the symlink */
-            rc = chdir(dirname(outName));
+            rc = chdir(dirname(strdupa(outName)));
 	    do {
 		buf = alloca(len + 1);
 		rc = readlink(basename(outName), buf, len);
-- 
1.7.10.4

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux