]> git.proxmox.com Git - pve-common.git/blobdiff - data/PVE/ProcFSTools.pm
correctly copy bridge config
[pve-common.git] / data / PVE / ProcFSTools.pm
index 2c2b376f7ff8d51ea2b9ac4f274de14d5ae9a2c8..e0a882854d72dd8a9dd6c765e17e81bf9b3d95c3 100644 (file)
@@ -1,6 +1,7 @@
 package PVE::ProcFSTools;
 
 use strict;
+use warnings;
 use POSIX;
 use Time::HiRes qw (gettimeofday);
 use IO::File;
@@ -245,4 +246,14 @@ sub read_proc_net_dev {
     return $res;
 }
 
+sub write_proc_entry {
+    my ($filename, $data) = @_;#
+
+    my $fh = IO::File->new($filename,  O_WRONLY);
+    die "unable to open file '$filename' - $!\n" if !$fh;
+    die "unable to write '$filename' - $!\n" unless print $fh $data;
+    die "closing file '$filename' failed - $!\n" unless close $fh;
+    $fh->close();
+}
+
 1;