[PATCH 10/11] Mark arguments to fopen/popen/system wrappers as const char *

Alan Coopersmith alan.coopersmith at oracle.com
Thu Nov 3 22:34:19 PDT 2011


Silencing more gcc -Wwrite-strings warnings

Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---

Brand new patch in this series.

 include/os.h |    6 +++---
 os/utils.c   |    6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/include/os.h b/include/os.h
index 53c0f7c..e938fdc 100644
--- a/include/os.h
+++ b/include/os.h
@@ -307,10 +307,10 @@ extern _X_EXPORT void OsReleaseSignals (void);
 extern _X_EXPORT void OsAbort (void) _X_NORETURN;
 
 #if !defined(WIN32)
-extern _X_EXPORT int System(char *);
-extern _X_EXPORT pointer Popen(char *, char *);
+extern _X_EXPORT int System(const char *);
+extern _X_EXPORT pointer Popen(const char *, const char *);
 extern _X_EXPORT int Pclose(pointer);
-extern _X_EXPORT pointer Fopen(char *, char *);
+extern _X_EXPORT pointer Fopen(const char *, const char *);
 extern _X_EXPORT int Fclose(pointer);
 #else
 #define System(a) system(a)
diff --git a/os/utils.c b/os/utils.c
index c828f01..b49fd32 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -1252,7 +1252,7 @@ OsAbort (void)
  */
 
 int
-System(char *command)
+System(const char *command)
 {
     int pid, p;
     void (*csig)(int);
@@ -1302,7 +1302,7 @@ static struct pid {
 OsSigHandlerPtr old_alarm = NULL; /* XXX horrible awful hack */
 
 pointer
-Popen(char *command, char *type)
+Popen(const char *command, const char *type)
 {
     struct pid *cur;
     FILE *iop;
@@ -1388,7 +1388,7 @@ Popen(char *command, char *type)
 
 /* fopen that drops privileges */
 pointer
-Fopen(char *file, char *type)
+Fopen(const char *file, const char *type)
 {
     FILE *iop;
 #ifndef HAS_SAVED_IDS_AND_SETEUID
-- 
1.7.3.2



More information about the xorg-devel mailing list