]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
Fix crash when /proc/acpi/ac_adapter/ is not present, for instance,
authorMatthias Andree <matthias.andree@gmx.de>
Thu, 13 Jan 2005 02:35:29 +0000 (03:35 +0100)
committerMatthias Andree <matthias.andree@gmx.de>
Thu, 13 Jan 2005 02:35:29 +0000 (03:35 +0100)
on pre-ACPI and non-Linux systems.

e2fsck/ChangeLog
e2fsck/unix.c

index 0fff501fd0a98c140be4d6f3451e91f76baf2f87..fb48f112da7d12776896aa9c1cfd6808833c0c1c 100644 (file)
@@ -1,3 +1,9 @@
+2005-01-13  Matthias Andree  <matthias.andree@gmx.de>
+
+       * unix.c: Do not call closedir if the handle is zero, to avoid
+               crashes when the /proc/acpi/ac_adapter directory is
+               missing, for instance on non-ACPI or non-Linux systems.
+
 2005-01-09  Theodore Ts'o  <tytso@mit.edu>
 
        * pass1b.c: As part of converting configure.in from using the
index 7e55f87aa0a217432631f54ab149d5e5f4652741..43a64b5ea48cb31ec9b128070d1aa02626666d6c 100644 (file)
@@ -238,7 +238,8 @@ static int is_on_batt(void)
                        return 1;
                }
        }
-       closedir(d);
+       if (d)
+               closedir(d);
        return 0;
 }