[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] getprogname: fix port to IRIX
From: |
Bruno Haible |
Subject: |
Re: [PATCH] getprogname: fix port to IRIX |
Date: |
Sat, 11 Nov 2017 20:42:40 +0100 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-98-generic; KDE/5.18.0; x86_64; ; ) |
On IRIX with cc, I'm seeing a compilation failure:
CC getprogname.o
cc-1140 cc: ERROR File = ../../lib/getprogname.c, Line = 167
A value of type "unsigned int" cannot be used to initialize an entity of type
"char *".
char *namesize = sizeof buf.pr_fname;
^
cc-1164 cc: ERROR File = ../../lib/getprogname.c, Line = 168
Argument of type "char *" is incompatible with parameter of type "size_t".
char *namenul = memchr (name, '\0', namesize);
^
cc-1042 cc: ERROR File = ../../lib/getprogname.c, Line = 169
The types of operands "int" and "char *" are incompatible.
size_t namelen = namenul ? namenul - name : namesize;
^
3 errors detected in the compilation of "../../lib/getprogname.c".
This patch fixes it.
2017-11-11 Bruno Haible <address@hidden>
getprogname: Fix compilation error on IRIX.
* lib/getprogname.c (getprogname) [__sgi]: Fix type of local variable
'namesize'.
diff --git a/lib/getprogname.c b/lib/getprogname.c
index 9c2ad36..ff61918 100644
--- a/lib/getprogname.c
+++ b/lib/getprogname.c
@@ -164,7 +164,7 @@ getprogname (void)
if (ioctl_ok)
{
char *name = buf.pr_fname;
- char *namesize = sizeof buf.pr_fname;
+ size_t namesize = sizeof buf.pr_fname;
char *namenul = memchr (name, '\0', namesize);
size_t namelen = namenul ? namenul - name : namesize;
char *namecopy = malloc (namelen + 1);
- Re: [PATCH] getprogname: fix port to IRIX,
Bruno Haible <=