Skip to contentSkip to conversation

Pom-ng: test return code from File::Copy

PATCH In review Martijn Lievaart 2 participants 2 messages May 5, 2004 – May 6, 2004 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Pom-ng: test return code from File::Copy

Hi,

Trying to work out how POM-ng works, I found a slight bug. The returncode from the File::Copy routine is not tested. Attached patch fixes that.

Cheers,
Martijn Lievaart

Netfilter_POM.pm +4 -1
@@ -682,7 +683,10 @@
 						return 0;
 					}
 				}
-				File::Copy::copy($srcfile, $destfile);
+				if (!File::Copy::copy($srcfile, $destfile)) {
+					$self->{ERRMSG} .= "unable to copy $srcfile to $destfile: $!\n";
+					return 0;
+				}
 				# .foo-test is executable
 				chmod((stat($srcfile))[2] & 07777, $destfile);
 			} else {