chiark / gitweb /
@@ -3,6 +3,10 @@
authorian <ian>
Thu, 25 Jan 2001 00:20:28 +0000 (00:20 +0000)
committerian <ian>
Thu, 25 Jan 2001 00:20:28 +0000 (00:20 +0000)
+  * #include <fcntl.h>, not <sys/fcntl.h> (fixes some implicit decls).
+  * gid_t may be >int, so cast to long when putting in USERV_GIDS
+    (Might conceivably make USERV_GIDS be wrong on some platforms.)
+  * Do not pass char to ctype macros; they can't cope with -ve !

both.h
client.c
debian/changelog
parser.c
process.c
servexec.c

diff --git a/both.h b/both.h
index 6fd04a5e2561cf56c2390fb71d7e6449e0698e5e..dc4c68a76109e6a5caaa5c3e442ed20f4f61e311 100644 (file)
--- a/both.h
+++ b/both.h
@@ -36,4 +36,6 @@ size_t working_fread(void *ptr, size_t sz, FILE *file);
 
 void syscallerror(const char *what) NONRETURNING;
 
+#define ISCHAR(iswotsit,ch) (iswotsit((unsigned char)(ch))) /*Feh!*/
+
 #endif
index 7f120134107c756f6fb5f82efbec34db6d50ce6b..c6b259bbd899c73046766ab8a1e33a572efe5ba5 100644 (file)
--- a/client.c
+++ b/client.c
@@ -284,7 +284,7 @@ static void getprogress(struct progress_msg *progress_r, FILE *file) {
       for (i=0; i<progress_r->data.errmsg.messagelen; i++) {
        c= working_getc(file);
        if (c==EOF) protoreaderror(file,"in error message");
-       if (isprint(c)) putc(c,stderr);
+       if (ISCHAR(isprint,c)) putc(c,stderr);
        else fprintf(stderr,"\\x%02x",(unsigned char)c);
       }
       putc('\n',stderr);
index 6c31e05266cbf5b6a09f40a8a7e3b47d2d3df6c7..044c131f3b761d397e06909d083e682594fca1f4 100644 (file)
@@ -3,6 +3,10 @@ userv (1.0.2) unstable; urgency=low
   * Specification's usage notes section improved.
   * --help and --version behaviour made to conform to GNU standards.
   * userv(1) manpage: fixed broken definitions of fd excl and trunc.
+  * #include <fcntl.h>, not <sys/fcntl.h> (fixes some implicit decls).
+  * gid_t may be >int, so cast to long when putting in USERV_GIDS
+    (Might conceivably make USERV_GIDS be wrong on some platforms.)
+  * Do not pass char to ctype macros; they can't cope with -ve !
 
  --
 
index b2c2b03896c41bb3c3450cf8d12d08d1b8f6128e..5700c3daef099a8b377b87cb3a33102e28e968a2 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -167,15 +167,15 @@ static int dequote(char *inplace) {
       *q++= v;
       continue;
     default:
-      if (isalpha(*p))
+      if (ISCHAR(isalpha,*p))
         return parseerrprint("unknown \\<letter> sequence \\%c in quoted string",*p);
-      if (isdigit(*p)) {
+      if (ISCHAR(isdigit,*p)) {
         if (!((buf[0]= *p++) && (buf[1]= *p++) && (buf[2]= *p++))) abort();
         buf[3]= 0; v= strtoul(buf,&bep,8);
         if (bep != buf+3 || (v & ~0xff))
           return parseerrprint("invalid \\<octal> sequence \\%s in quoted string",buf);
         *q++= v; continue;
-      } else if (ispunct(*p)) {
+      } else if (ISCHAR(ispunct,*p)) {
         *q++= *p++; continue;
       } else {
        while (*p==' ' || *p=='\t') p++;
@@ -223,8 +223,8 @@ const char *printtoken(int token) {
     l= strlen(buf); i= sizeof(buf)-l-2; p= yytext; q= buf+l;
     while ((c= *p++)) {
       if (i-- <= 0) { q--; strcpy(q-3,"..."); break; }
-      if (isspace(c)) c= ' ';
-      else if (!isprint(c) || iscntrl(c)) c= '?';
+      if (ISCHAR(isspace,c)) c= ' ';
+      else if (!ISCHAR(isprint,c) || ISCHAR(iscntrl,c)) c= '?';
       else *q++= c;
     }
     strcpy(q,"'");
@@ -619,11 +619,11 @@ int pcf_grep(int ctoken, char *const *pv, int *rtrue) {
   buf= xmalloc(maxlen+2); actrue= 0; c= 0;
   while (!actrue && c!=EOF) {
     c= getc(file); if (c==EOF) break;
-    if (isspace(c)) continue;
+    if (ISCHAR(isspace,c)) continue;
     l= maxlen+1; p= buf;
     while (l>0 && c!='\n' && c!=EOF) { *p++= c; l--; c= getc(file); } 
-    if (c=='\n' || c==EOF || isspace(c)) {
-      while (p>buf && isspace(p[-1])) --p;
+    if (c=='\n' || c==EOF || ISCHAR(isspace,c)) {
+      while (p>buf && ISCHAR(isspace,p[-1])) --p;
       *p= 0; posstrue= 0;
       for (pp= pv; !posstrue && *pp; pp++)
        if (!strcmp(*pp,buf)) posstrue= 1;
@@ -634,7 +634,7 @@ int pcf_grep(int ctoken, char *const *pv, int *rtrue) {
       for (;;) {
         c= getc(file);
         if (c==EOF || c=='\n') break;
-        if (!isspace(c)) posstrue= 0;
+        if (!ISCHAR(isspace,c)) posstrue= 0;
       }
     }
     if (posstrue) actrue= 1;
@@ -751,7 +751,7 @@ int df_executefromdirectory(int dtoken) {
 
   r= paa_pathargs(&rv,&newargs); if (r) return r;
   p= strrchr(service,'/'); if (p) p++; else p= service;
-  if (!*p || !isalnum(*p)) {
+  if (!*p || !ISCHAR(isalnum,*p)) {
     parseerrprint("execute-from-directory requires initial char of service "
                  "portion to be alphanumeric (service portion was `%s')",
                  p);
@@ -759,7 +759,7 @@ int df_executefromdirectory(int dtoken) {
     return tokv_error;
   }
   for (q=p+1; *q; q++) {
-    if (!isalnum(*q) && *q != '-') {
+    if (!ISCHAR(isalnum,*q) && *q != '-') {
       parseerrprint("execute-from-directory requires service portion to "
                    "contain only alphanumerics and hyphens (was `%s')",
                    p);
@@ -999,8 +999,8 @@ int df_includedirectory(int dtoken) {
     tel= strlen(de->d_name);
     if (!tel) continue;
     p= de->d_name;
-    if (!*p || !isalnum(*p)) continue;
-    while ((c= *++p)) if (!(isalnum(c) || c=='-')) break;
+    if (!*p || !ISCHAR(isalnum,*p)) continue;
+    while ((c= *++p)) if (!(ISCHAR(isalnum,c) || c=='-')) break;
     if (c) continue;
     if (makeroom(&buildbuf,&buildbuflen,cpl+1+tel+1)) {
       stringoverflow("pathname in directory");
index 636255a286f18209d2eed766e18d42bf260ec169..c4a4809ed419774707be172ef2023b03ad8bf14d 100644 (file)
--- a/process.c
+++ b/process.c
 #include <syslog.h>
 #include <pwd.h>
 #include <grp.h>
-#include <ctype.h>
 #include <limits.h>
+#include <fcntl.h>
 #include <sys/wait.h>
 #include <sys/time.h>
 #include <sys/resource.h>
-#include <sys/fcntl.h>
+#include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/socket.h>
 #include <sys/un.h>
index 01353cdaab6c643b8fb09f93b1aa141793574b4e..a71b64f1e78bac9663f3c4f26c54ab357709b657 100644 (file)
@@ -191,7 +191,7 @@ static const char *see_c_group(void) {
 static const char *seei_gid(int i) {
   static char buf[CHAR_BIT*sizeof(gid_t)/3+4];
   
-  snyprintf(buf,sizeof(buf),"%d",calling_gids[i]);
+  snyprintf(buf,sizeof(buf),"%ld",(long)calling_gids[i]);
   return buf;
 }
 static const char *see_c_gid(void) {