]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - misc/fstab.c
Prefer https to http for gnu.org and fsf.org URLs
[thirdparty/glibc.git] / misc / fstab.c
index f053f8d69fbcd35b04a6f0d990c7ac395f849083..7a6282127b40f30371ac846a8665a7b0cabf0264 100644 (file)
@@ -1,27 +1,26 @@
-/* Copyright (C) 1995, 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2019 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
 
    The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
+   Lesser General Public License for more details.
 
-   You should have received a copy of the GNU Library General Public
-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
 
 #include <fstab.h>
 #include <mntent.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <bits/libc-lock.h>
+#include <libc-lock.h>
 
 #define BUFFER_SIZE 0x1fc0
 
@@ -62,8 +61,7 @@ getfsent (void)
 
 
 struct fstab *
-getfsspec (name)
-     const char *name;
+getfsspec (const char *name)
 {
   struct fstab_state *state;
   struct mntent *m;
@@ -79,8 +77,7 @@ getfsspec (name)
 
 
 struct fstab *
-getfsfile (name)
-     const char *name;
+getfsfile (const char *name)
 {
   struct fstab_state *state;
   struct mntent *m;
@@ -96,7 +93,7 @@ getfsfile (name)
 
 
 void
-endfsent ()
+endfsent (void)
 {
   struct fstab_state *state;
 
@@ -166,12 +163,12 @@ fstab_convert (struct fstab_state *state)
   f->fs_file = m->mnt_dir;
   f->fs_vfstype = m->mnt_type;
   f->fs_mntops = m->mnt_opts;
-  f->fs_type = (__hasmntopt (m, FSTAB_RW) ? FSTAB_RW :
-               __hasmntopt (m, FSTAB_RQ) ? FSTAB_RQ :
-               __hasmntopt (m, FSTAB_RO) ? FSTAB_RO :
-               __hasmntopt (m, FSTAB_SW) ? FSTAB_SW :
-               __hasmntopt (m, FSTAB_XX) ? FSTAB_XX :
-               "??");
+  f->fs_type = (__hasmntopt (m, FSTAB_RW) ? FSTAB_RW
+               : __hasmntopt (m, FSTAB_RQ) ? FSTAB_RQ
+               : __hasmntopt (m, FSTAB_RO) ? FSTAB_RO
+               : __hasmntopt (m, FSTAB_SW) ? FSTAB_SW
+               : __hasmntopt (m, FSTAB_XX) ? FSTAB_XX
+               "??");
   f->fs_freq = m->mnt_freq;
   f->fs_passno = m->mnt_passno;
   return f;
@@ -180,15 +177,10 @@ fstab_convert (struct fstab_state *state)
 
 /* Make sure the memory is freed if the programs ends while in
    memory-debugging mode and something actually was allocated.  */
-static void
-__attribute__ ((unused))
-fstab_free (void)
+libc_freeres_fn (fstab_free)
 {
   char *buffer;
 
   buffer = fstab_state.fs_buffer;
-  if (buffer != NULL)
-    free ((void *) buffer);
+  free ((void *) buffer);
 }
-
-text_set_element (__libc_subfreeres, fstab_free);