]> git.proxmox.com Git - mirror_smartmontools-debian.git/blobdiff - utility.h
Imported Upstream version 6.4+svn4214
[mirror_smartmontools-debian.git] / utility.h
index 346e0f33297a9c321d8a66e9168e7d8fc87df534..02c913bf7320c06f6188852c2482ed936fe385e5 100644 (file)
--- a/utility.h
+++ b/utility.h
@@ -1,10 +1,10 @@
 /*
  * utility.h
  *
- * Home page of code is: http://smartmontools.sourceforge.net
+ * Home page of code is: http://www.smartmontools.org
  *
- * Copyright (C) 2002-11 Bruce Allen <smartmontools-support@lists.sourceforge.net>
- * Copyright (C) 2008-14 Christian Franke <smartmontools-support@lists.sourceforge.net>
+ * Copyright (C) 2002-11 Bruce Allen
+ * Copyright (C) 2008-15 Christian Franke
  * Copyright (C) 2000 Michael Cornwell <cornwell@acm.org>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -25,7 +25,7 @@
 #ifndef UTILITY_H_
 #define UTILITY_H_
 
-#define UTILITY_H_CVSID "$Id: utility.h 4028 2014-12-13 14:59:48Z chrfranke $"
+#define UTILITY_H_CVSID "$Id: utility.h 4145 2015-10-17 12:01:38Z chrfranke $"
 
 #include <time.h>
 #include <sys/types.h> // for regex.h (according to POSIX)
@@ -194,6 +194,8 @@ public:
 
   bool open(const char * name, const char * mode)
     {
+      if (m_file && m_owner)
+        fclose(m_file);
       m_file = fopen(name, mode);
       m_owner = true;
       return !!m_file;
@@ -201,6 +203,8 @@ public:
 
   void open(FILE * f, bool owner = false)
     {
+      if (m_file && m_owner)
+        fclose(m_file);
       m_file = f;
       m_owner = owner;
     }