[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdelibs/kdecore [POSSIBLY UNSAFE]
From:       Oswald Buddenhagen <ossi () kde ! org>
Date:       2003-11-07 12:53:48
[Download RAW message or body]

CVS commit by ossi: 

cleanup.
don't call revoke() on linux, as it's a dummy ... linux sucks! ;)


  M +10 -12    kgrantpty.c   1.11 [POSSIBLY UNSAFE: printf]


--- kdelibs/kdecore/kgrantpty.c  #1.10:1.11
@@ -117,13 +117,10 @@ int main (int argc, char *argv[])
           if (dirp->d_fileno != dsb.st_ino)
             continue;
-          {
-          int pdlen = strlen(_PATH_DEV), namelen = strlen(dirp->d_name);
-          pty = malloc(pdlen + namelen + 1);
+          pty = malloc(sizeof(_PATH_DEV) + strlen(dirp->d_name));
           if (pty) {
-            *pty = 0;
-            strcat(pty, _PATH_DEV);
+            strcpy(pty, _PATH_DEV);
             strcat(pty, dirp->d_name);
           }
-          }
+          break;
         }
 
@@ -139,5 +136,5 @@ int main (int argc, char *argv[])
   if (pty == NULL)
   {
-    fprintf(stderr,"%s: cannot determine the name of device.\n",argv[0]);
+    fprintf(stderr,"%s: cannot determine pty name.\n",argv[0]);
     return 1; /* FAIL */
   }
@@ -147,5 +144,5 @@ int main (int argc, char *argv[])
   if (strlen(pty) < 8 || strncmp(pty,"/dev/pty",8))
   {
-    fprintf(stderr,"%s: determined a strange device name `%s'.\n",argv[0],pty);
+    fprintf(stderr,"%s: determined a strange pty name `%s'.\n",argv[0],pty);
     return 1; /* FAIL */
   }
@@ -166,5 +163,5 @@ int main (int argc, char *argv[])
   if (chown(tty, uid, gid) < 0)
   {
-    fprintf(stderr,"%s: cannot chown %s.\n",argv[0],tty); perror("Reason");
+    fprintf(stderr,"%s: cannot chown %s: %s\n",argv[0],tty,strerror(errno));
     return 1; /* FAIL */
   }
@@ -172,14 +169,15 @@ int main (int argc, char *argv[])
   if (chmod(tty, mod) < 0)
   {
-    fprintf(stderr,"%s: cannot chmod %s.\n",argv[0],tty); perror("Reason");
+    fprintf(stderr,"%s: cannot chmod %s: %s\n",argv[0],tty,strerror(errno));
     return 1; /* FAIL */
   }
 
+#ifndef __linux__
   if (revoke(tty) < 0)
   {
-    fprintf(stderr,"%s: cannot revoke %s.\n",argv[0],tty); perror("Reason");
+    fprintf(stderr,"%s: cannot revoke %s: %s\n",argv[0],tty,strerror(errno));
     return 1; /* FAIL */
   }
-
+#endif
 
   return 0; /* OK */


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic