Memory leaks and ineffective bounds checking in wasm_scan
[deliverable/binutils-gdb.git] / binutils / filemode.c
index f9811bc4926c25932810fecb49e9acf208fd3c36..c885f8626a74f1b96063bfb93a29885dc2d9845a 100644 (file)
@@ -1,9 +1,9 @@
 /* filemode.c -- make a string describing file modes
 /* filemode.c -- make a string describing file modes
-   Copyright (C) 1985, 90, 91, 94, 95, 97, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1985-2020 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
+   the Free Software Foundation; either version 3, or (at your option)
    any later version.
 
    This program is distributed in the hope that it will be useful,
    any later version.
 
    This program is distributed in the hope that it will be useful,
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-   02111-1307, USA.  */
+   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+   02110-1301, USA.  */
 \f
 \f
+#include "sysdep.h"
 #include "bfd.h"
 #include "bucomm.h"
 
 #include "bfd.h"
 #include "bucomm.h"
 
-static char ftypelet PARAMS ((unsigned long));
-static void setst PARAMS ((unsigned long, char *));
+static char ftypelet (unsigned long);
+static void setst (unsigned long, char *);
 
 /* filemodestring - fill in string STR with an ls-style ASCII
    representation of the st_mode field of file stats block STATP.
 
 /* filemodestring - fill in string STR with an ls-style ASCII
    representation of the st_mode field of file stats block STATP.
@@ -56,21 +57,7 @@ static void setst PARAMS ((unsigned long, char *));
    9   'x' if any user may execute, 't' if the file is "sticky"
        (will be retained in swap space after execution), '-'
        otherwise.
    9   'x' if any user may execute, 't' if the file is "sticky"
        (will be retained in swap space after execution), '-'
        otherwise.
-       'T' if the file is sticky but not executable. */
-
-#if 0
-
-/* This is not used; only mode_string is used.  */
-
-void
-filemodestring (statp, str)
-     struct stat *statp;
-     char *str;
-{
-  mode_string ((unsigned long) statp->st_mode, str);
-}
-
-#endif
+       'T' if the file is sticky but not executable.  */
 
 /* Get definitions for the file permission bits.  */
 
 
 /* Get definitions for the file permission bits.  */
 
@@ -114,12 +101,10 @@ filemodestring (statp, str)
 #endif
 
 /* Like filemodestring, but only the relevant part of the `struct stat'
 #endif
 
 /* Like filemodestring, but only the relevant part of the `struct stat'
-   is given as an argument. */
+   is given as an argument.  */
 
 void
 
 void
-mode_string (mode, str)
-     unsigned long mode;
-     char *str;
+mode_string (unsigned long mode, char *str)
 {
   str[0] = ftypelet ((unsigned long) mode);
   str[1] = (mode & S_IRUSR) != 0 ? 'r' : '-';
 {
   str[0] = ftypelet ((unsigned long) mode);
   str[1] = (mode & S_IRUSR) != 0 ? 'r' : '-';
@@ -139,11 +124,11 @@ mode_string (mode, str)
    'd' for directories
    'b' for block special files
    'c' for character special files
    'd' for directories
    'b' for block special files
    'c' for character special files
-   'm' for multiplexor files
+   'm' for multiplexer files
    'l' for symbolic links
    's' for sockets
    'p' for fifos
    'l' for symbolic links
    's' for sockets
    'p' for fifos
-   '-' for any other file type. */
+   '-' for any other file type.  */
 
 #ifndef S_ISDIR
 #ifdef S_IFDIR
 
 #ifndef S_ISDIR
 #ifdef S_IFDIR
@@ -194,8 +179,7 @@ mode_string (mode, str)
 #endif /* ! defined (S_ISLNK) */
 
 static char
 #endif /* ! defined (S_ISLNK) */
 
 static char
-ftypelet (bits)
-     unsigned long bits;
+ftypelet (unsigned long bits)
 {
   if (S_ISDIR (bits))
     return 'd';
 {
   if (S_ISDIR (bits))
     return 'd';
@@ -226,18 +210,16 @@ ftypelet (bits)
 }
 
 /* Set the 's' and 't' flags in file attributes string CHARS,
 }
 
 /* Set the 's' and 't' flags in file attributes string CHARS,
-   according to the file mode BITS. */
+   according to the file mode BITS.  */
 
 static void
 
 static void
-setst (bits, chars)
-     unsigned long bits ATTRIBUTE_UNUSED;
-     char *chars ATTRIBUTE_UNUSED;
+setst (unsigned long bits ATTRIBUTE_UNUSED, char *chars ATTRIBUTE_UNUSED)
 {
 #ifdef S_ISUID
   if (bits & S_ISUID)
     {
       if (chars[3] != 'x')
 {
 #ifdef S_ISUID
   if (bits & S_ISUID)
     {
       if (chars[3] != 'x')
-       /* Set-uid, but not executable by owner. */
+       /* Set-uid, but not executable by owner.  */
        chars[3] = 'S';
       else
        chars[3] = 's';
        chars[3] = 'S';
       else
        chars[3] = 's';
@@ -247,7 +229,7 @@ setst (bits, chars)
   if (bits & S_ISGID)
     {
       if (chars[6] != 'x')
   if (bits & S_ISGID)
     {
       if (chars[6] != 'x')
-       /* Set-gid, but not executable by group. */
+       /* Set-gid, but not executable by group.  */
        chars[6] = 'S';
       else
        chars[6] = 's';
        chars[6] = 'S';
       else
        chars[6] = 's';
@@ -257,7 +239,7 @@ setst (bits, chars)
   if (bits & S_ISVTX)
     {
       if (chars[9] != 'x')
   if (bits & S_ISVTX)
     {
       if (chars[9] != 'x')
-       /* Sticky, but not executable by others. */
+       /* Sticky, but not executable by others.  */
        chars[9] = 'T';
       else
        chars[9] = 't';
        chars[9] = 'T';
       else
        chars[9] = 't';
This page took 0.032084 seconds and 4 git commands to generate.