Sisyphus repository
Last update: 1 october 2023 | SRPMs: 18631 | Visits: 37894753
en ru br
ALT Linux repos
S:0.25-alt6
5.0: 0.25-alt1
4.1: 0.25-alt1

Group :: Development/Perl
RPM: perl-PPerl

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs and FR  Repocop 

Patch: PPerl-0.25-misc_fix.patch
Download


Fixes for compiler's warnings and so on
--- ./main.c
+++ ./main.c
@@ -17,6 +17,7 @@
 #include <signal.h>
 #include <unistd.h>
 #include "pperl.h"
+#include <sys/file.h> /* for flock */
 
 #include "pass_fd.h" /* the stuff borrowed from stevens */
 
@@ -72,7 +73,7 @@ void Debug( const char * format, ...)
 int main( int argc, char **argv )
 {
     int i;
-    char *pArg;
+    char *pArg = NULL;
     int pperl_section = 0;
     int return_code = 0;
 
@@ -264,15 +265,14 @@ static int handle_socket(int sd, int argc, char **argv );
 static int DispatchCall( char *scriptname, int argc, char **argv )
 {
     register int i, sd, len;
-    int error_number;
-    ssize_t readlen;
+    ssize_t readlen, writelen;
     struct sockaddr_un saun;
     struct stat stat_buf;
     struct stat sock_stat;
     char *sock_name;
     char buf[BUF_SIZE];
     int respawn_script = 0;
-	sd = 0;
+        sd = 0;
 
     /* create socket name */
     Dx(Debug("pperl: %s\n", scriptname));
@@ -306,7 +306,7 @@ static int DispatchCall( char *scriptname, int argc, char **argv )
         pid_fd = open(pid_file, O_RDONLY);
         if (pid_fd == -1) {
             Dx(Debug("Cannot open pid file (perhaps PPerl wasn't running for that script?)\n"));
-            write(1, "No process killed - no pid file\n", 32);
+            writelen=write(1, "No process killed - no pid file\n", 32);
             goto killed;
         }
         
@@ -454,8 +454,8 @@ static int DispatchCall( char *scriptname, int argc, char **argv )
             goto cleanup;
         }
             
-        write(tmp_fd, "### Temp File ###\n", 18);
-        write(tmp_fd, perl_header, strlen(perl_header));
+        writelen=write(tmp_fd, "### Temp File ###\n", 18);
+        writelen=write(tmp_fd, perl_header, strlen(perl_header));
 
         /* rewrite the perl script with pperl.h.header contents wrapper
            and do some other fixups in the process */
@@ -475,17 +475,17 @@ static int DispatchCall( char *scriptname, int argc, char **argv )
                         strncat(perl_options, args, strlen(args) - 1);
                     }
 
-                    write(tmp_fd, "\n#line 2 ", 9);
-                    write(tmp_fd, scriptname, strlen(scriptname));
-                    write(tmp_fd, "\n", 1);
+                    writelen=write(tmp_fd, "\n#line 2 ", 9);
+                    writelen=write(tmp_fd, scriptname, strlen(scriptname));
+                    writelen=write(tmp_fd, "\n", 1);
 
                     line = 2;
                     continue;
                 }
                 else {
-                    write(tmp_fd, "\n#line 1 ", 9);
-                    write(tmp_fd, scriptname, strlen(scriptname));
-                    write(tmp_fd, "\n", 1);
+                    writelen=write(tmp_fd, "\n#line 1 ", 9);
+                    writelen=write(tmp_fd, scriptname, strlen(scriptname));
+                    writelen=write(tmp_fd, "\n", 1);
                 }
             }
             if ((!strcmp(buf, "__END__\n") || 
@@ -493,11 +493,11 @@ static int DispatchCall( char *scriptname, int argc, char **argv )
                 !wrote_footer) {
                 char text_line[BUF_SIZE];
                 wrote_footer = 1;
-                write(tmp_fd, perl_footer, strlen(perl_footer));
+                writelen=write(tmp_fd, perl_footer, strlen(perl_footer));
                 snprintf(text_line, BUF_SIZE, "package main;\n#line %d %s\n", line, scriptname);
-                write(tmp_fd, text_line, strlen(text_line));
+                writelen=write(tmp_fd, text_line, strlen(text_line));
             }
-            write(tmp_fd, buf, readlen);
+            writelen=write(tmp_fd, buf, readlen);
             if (buf[readlen] == '\n') ++line;
         }
         
@@ -508,7 +508,7 @@ static int DispatchCall( char *scriptname, int argc, char **argv )
         }
 
         if (!wrote_footer) 
-            write(tmp_fd, perl_footer, strlen(perl_footer));
+            writelen=write(tmp_fd, perl_footer, strlen(perl_footer));
 
         Dx(Debug("wrote file %s\n", temp_file));
 
@@ -589,10 +589,11 @@ handle_socket(int sd, int argc, char **argv) {
     char **env;
     int i;
     char buf[BUF_SIZE];
+    ssize_t readlen, writelen;
 
     Dx(Debug("connected over %d\n", sd));
 
-    read(sd, buf, 10);
+    readlen=read(sd, buf, 10);
     buf[10] = '\0';
     connected_to = atoi(buf);
     Dx(Debug("chatting to %d, hooking signals\n", connected_to));
@@ -612,51 +613,51 @@ handle_socket(int sd, int argc, char **argv) {
     for (i = 0; i < max_fd; i++) {
         if (fcntl(i, F_GETFL, -1) >= 0 && i != sd) {
             int ret;
-            write(sd, &i, sizeof(int));
+            writelen=write(sd, &i, sizeof(int));
             ret = send_fd(sd, i);
             Dx(Debug("send_fd %d %d\n", i, ret));
         }
     }
     i = -1;
-    write(sd, &i, sizeof(int));
+    writelen=write(sd, &i, sizeof(int));
     Dx(Debug("fds sent\n"));
 
-    write(sd, "[PID]", 6);
+    writelen=write(sd, "[PID]", 6);
     snprintf(buf, BUF_SIZE, "%d", getpid());
-    write(sd, buf, strlen(buf) + 1);
+    writelen=write(sd, buf, strlen(buf) + 1);
 
     
     /* print to socket... */
-    write(sd, "[ENV]", 6);
+    writelen=write(sd, "[ENV]", 6);
     for (i= 0, env = environ; *env; i++, env++); 
     snprintf(buf, BUF_SIZE, "%d", i);
-    write(sd, buf, strlen(buf) + 1);
+    writelen=write(sd, buf, strlen(buf) + 1);
     
     while ( *environ != NULL ) {
         size_t len = strlen(*environ) + 1;
         /* Dx(Debug("sending environ: %s\n", *environ)); */
-        write(sd, *environ, len);
+        writelen=write(sd, *environ, len);
         environ++;
     }
 
-    write(sd, "[CWD]", 6);
+    writelen=write(sd, "[CWD]", 6);
     if (getcwd(buf, BUF_SIZE) == NULL) {
         perror("pperl: getcwd");
         exit (1);
     }
-    write(sd, buf, strlen(buf) + 1);
+    writelen=write(sd, buf, strlen(buf) + 1);
 
     Dx(Debug("sending %d args\n", argc));
-    write(sd, "[ARGV]", 7);
+    writelen=write(sd, "[ARGV]", 7);
     snprintf(buf, BUF_SIZE, "%d", argc);
-    write(sd, buf, strlen(buf) + 1);
+    writelen=write(sd, buf, strlen(buf) + 1);
     for (i = 0; i < argc; i++) {
         size_t len = strlen(argv[i]) + 1;
         Dx(Debug("sending argv[%d]: '%s'\n", i, argv[i]));
-        write(sd, argv[i], len);
+        writelen=write(sd, argv[i], len);
     }
 
-    write(sd, "[DONE]", 7);
+    writelen=write(sd, "[DONE]", 7);
 
     Dx(Debug("waiting for OK message from %d\n", sd));
     if (read(sd, buf, 3) != 3) {
--- ./PPerl.xs
+++ ./PPerl.xs
@@ -51,8 +51,9 @@ recv_fd(on)
   int fd
   CODE:
     int foo;
+    ssize_t readlen;
 
-    read(fd, &foo, sizeof(foo));
+    readlen = read(fd, &foo, sizeof(foo));
     RETVAL = foo;
   OUTPUT:
     RETVAL
 
design & coding: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
current maintainer: Michael Shigorin