[Libguestfs] [PATCH 3/3] Check return value from readlink.

Richard W.M. Jones rjones at redhat.com
Wed Sep 23 11:14:36 UTC 2009


-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
New in Fedora 11: Fedora Windows cross-compiler. Compile Windows
programs, test, and build Windows installers. Over 70 libraries supprt'd
http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw
-------------- next part --------------
>From 75b6338da3e6e33c02b931623f074ab5a76a1788 Mon Sep 17 00:00:00 2001
From: Richard Jones <rjones at trick.home.annexia.org>
Date: Wed, 23 Sep 2009 12:09:26 +0100
Subject: [PATCH 3/3] Check return value from readlink.

---
 cat/run-cat-locally             |    2 +-
 df/run-df-locally               |    2 +-
 edit/run-edit-locally           |    2 +-
 inspector/run-inspector-locally |    2 +-
 rescue/run-rescue-locally       |    2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/cat/run-cat-locally b/cat/run-cat-locally
index bba2c08..be60d07 100755
--- a/cat/run-cat-locally
+++ b/cat/run-cat-locally
@@ -34,7 +34,7 @@ my $path = $0;
 
 # Follow symlinks until we get to the real file
 while(-l $path) {
-    my $link = readlink($path);
+    my $link = readlink($path) or die "readlink: $path: $!";
     if(File::Spec->file_name_is_absolute($link)) {
         $path = $link;
     } else {
diff --git a/df/run-df-locally b/df/run-df-locally
index 3557443..f8a50aa 100755
--- a/df/run-df-locally
+++ b/df/run-df-locally
@@ -34,7 +34,7 @@ my $path = $0;
 
 # Follow symlinks until we get to the real file
 while(-l $path) {
-    my $link = readlink($path);
+    my $link = readlink($path) or die "readlink: $path: $!";
     if(File::Spec->file_name_is_absolute($link)) {
         $path = $link;
     } else {
diff --git a/edit/run-edit-locally b/edit/run-edit-locally
index 90968a2..3a6a9ab 100755
--- a/edit/run-edit-locally
+++ b/edit/run-edit-locally
@@ -34,7 +34,7 @@ my $path = $0;
 
 # Follow symlinks until we get to the real file
 while(-l $path) {
-    my $link = readlink($path);
+    my $link = readlink($path) or die "readlink: $path: $!";
     if(File::Spec->file_name_is_absolute($link)) {
         $path = $link;
     } else {
diff --git a/inspector/run-inspector-locally b/inspector/run-inspector-locally
index 156f3ae..6106282 100755
--- a/inspector/run-inspector-locally
+++ b/inspector/run-inspector-locally
@@ -34,7 +34,7 @@ my $path = $0;
 
 # Follow symlinks until we get to the real file
 while(-l $path) {
-    my $link = readlink($path);
+    my $link = readlink($path) or die "readlink: $path: $!";
     if(File::Spec->file_name_is_absolute($link)) {
         $path = $link;
     } else {
diff --git a/rescue/run-rescue-locally b/rescue/run-rescue-locally
index d814ed5..33191e7 100755
--- a/rescue/run-rescue-locally
+++ b/rescue/run-rescue-locally
@@ -35,7 +35,7 @@ my $path = $0;
 
 # Follow symlinks until we get to the real file
 while(-l $path) {
-    my $link = readlink($path);
+    my $link = readlink($path) or die "readlink: $path: $!";
     if(File::Spec->file_name_is_absolute($link)) {
         $path = $link;
     } else {
-- 
1.6.2.5



More information about the Libguestfs mailing list