Forráskód Böngészése

Use pid instead of c1 for variable name

Guillem Jover 15 éve
szülő
commit
44e022a801
6 módosított fájl, 34 hozzáadás és 31 törlés
  1. 4 4
      dpkg-deb/extract.c
  2. 4 4
      dpkg-deb/info.c
  3. 4 4
      dselect/method.cc
  4. 5 4
      src/archives.c
  5. 9 8
      src/help.c
  6. 8 7
      src/processarc.c

+ 4 - 4
dpkg-deb/extract.c

@@ -52,14 +52,14 @@
 
 static void movecontrolfiles(const char *thing) {
   char buf[200];
-  pid_t c1;
+  pid_t pid;
 
   sprintf(buf, "mv %s/* . && rmdir %s", thing, thing);
-  c1 = subproc_fork();
-  if (!c1) {
+  pid = subproc_fork();
+  if (pid == 0) {
     command_shell(buf, _("shell command to move files"));
   }
-  subproc_wait_check(c1, _("shell command to move files"), 0);
+  subproc_wait_check(pid, _("shell command to move files"), 0);
 }
 
 static void DPKG_ATTR_NORET

+ 4 - 4
dpkg-deb/info.c

@@ -48,7 +48,7 @@
 #include "dpkg-deb.h"
 
 static void cu_info_prepare(int argc, void **argv) {
-  pid_t c1;
+  pid_t pid;
   char *dir;
   struct stat stab;
 
@@ -58,12 +58,12 @@ static void cu_info_prepare(int argc, void **argv) {
   if (lstat(dir, &stab) && errno == ENOENT)
     return;
 
-  c1 = subproc_fork();
-  if (!c1) {
+  pid = subproc_fork();
+  if (pid == 0) {
     execlp(RM, "rm", "-rf", dir, NULL);
     ohshite(_("unable to execute %s (%s)"), _("rm command for cleanup"), RM);
   }
-  subproc_wait_check(c1, _("rm command for cleanup"), 0);
+  subproc_wait_check(pid, _("rm command for cleanup"), 0);
 }
 
 static void info_prepare(const char *const **argvp,

+ 4 - 4
dselect/method.cc

@@ -139,20 +139,20 @@ static enum urqresult lockmethod(void) {
 static urqresult
 falliblesubprocess(struct command *cmd)
 {
-  pid_t c1;
+  pid_t pid;
   int status, i, c;
 
   cursesoff();
 
   subproc_signals_setup(cmd->name);
 
-  c1 = subproc_fork();
-  if (!c1) {
+  pid = subproc_fork();
+  if (pid == 0) {
     subproc_signals_cleanup(0, 0);
     command_exec(cmd);
   }
 
-  status = subproc_wait(c1, cmd->name);
+  status = subproc_wait(pid, cmd->name);
 
   pop_cleanup(ehflag_normaltidy);
 

+ 5 - 4
src/archives.c

@@ -1187,7 +1187,8 @@ void archivefiles(const char *const *argv) {
   const char *volatile thisarg;
   const char *const *volatile argp;
   jmp_buf ejbuf;
-  int pi[2], fc, nfiles, c, i, r;
+  int pi[2], nfiles, c, i, r;
+  pid_t pid;
   FILE *pf;
   static struct varbuf findoutput;
   const char **arglist;
@@ -1209,8 +1210,8 @@ void archivefiles(const char *const *argv) {
       badusage(_("--%s --recursive needs at least one path argument"),cipaction->olong);
 
     m_pipe(pi);
-    fc = subproc_fork();
-    if (!fc) {
+    pid = subproc_fork();
+    if (pid == 0) {
       struct command cmd;
       const char *const *ap;
 
@@ -1245,7 +1246,7 @@ void archivefiles(const char *const *argv) {
     }
     if (ferror(pf)) ohshite(_("error reading find's pipe"));
     if (fclose(pf)) ohshite(_("error closing find's pipe"));
-    r = subproc_wait_check(fc, "find", PROCNOERR);
+    r = subproc_wait_check(pid, "find", PROCNOERR);
     if (r != 0)
       ohshit(_("find for --recursive returned unhandled error %i"),r);
 

+ 9 - 8
src/help.c

@@ -255,14 +255,15 @@ static int
 do_script(struct pkginfo *pkg, struct pkgbin *pif,
           struct command *cmd, struct stat *stab, int warn)
 {
-  int c1, r;
+  pid_t pid;
+  int r;
 
   setexecute(cmd->filename, stab);
 
   push_cleanup(cu_post_script_tasks, ehflag_bombout, NULL, 0, 0);
 
-  c1 = subproc_fork();
-  if (!c1) {
+  pid = subproc_fork();
+  if (pid == 0) {
     if (setenv("DPKG_MAINTSCRIPT_PACKAGE", pkg->name, 1) ||
         setenv("DPKG_MAINTSCRIPT_ARCH", pif->architecture, 1) ||
         setenv("DPKG_MAINTSCRIPT_NAME", cmd->argv[0], 1) ||
@@ -273,7 +274,7 @@ do_script(struct pkginfo *pkg, struct pkgbin *pif,
     command_exec(cmd);
   }
   subproc_signals_setup(cmd->name); /* This does a push_cleanup(). */
-  r = subproc_wait_check(c1, cmd->name, warn);
+  r = subproc_wait_check(pid, cmd->name, warn);
   pop_cleanup(ehflag_normaltidy);
 
   pop_cleanup(ehflag_normaltidy);
@@ -566,7 +567,7 @@ secure_unlink_statted(const char *pathname, const struct stat *stab)
 }
 
 void ensure_pathname_nonexisting(const char *pathname) {
-  int c1;
+  pid_t pid;
   const char *u;
 
   u = path_skip_slash_dotslash(pathname);
@@ -586,13 +587,13 @@ void ensure_pathname_nonexisting(const char *pathname) {
   if (errno != ENOTEMPTY && errno != EEXIST) { /* Huh? */
     ohshite(_("unable to securely remove '%.255s'"), pathname);
   }
-  c1 = subproc_fork();
-  if (!c1) {
+  pid = subproc_fork();
+  if (pid == 0) {
     execlp(RM, "rm", "-rf", "--", pathname, NULL);
     ohshite(_("unable to execute %s (%s)"), _("rm command for cleanup"), RM);
   }
   debug(dbg_eachfile,"ensure_pathname_nonexisting running rm -rf");
-  subproc_wait_check(c1, "rm cleanup", 0);
+  subproc_wait_check(pid, "rm cleanup", 0);
 }
 
 void log_action(const char *action, struct pkginfo *pkg) {

+ 8 - 7
src/processarc.c

@@ -178,7 +178,8 @@ void process_archive(const char *filename) {
   static struct varbuf infofnvb, fnvb, depprobwhy;
   static struct tarcontext tc;
 
-  int c1, r, admindirlen, i, infodirlen, infodirbaseused;
+  int r, admindirlen, i, infodirlen, infodirbaseused;
+  pid_t pid;
   struct pkgiterator *it;
   struct pkginfo *pkg, *otherpkg, *divpkg;
   char *cidir, *cidirrest, *p;
@@ -244,14 +245,14 @@ void process_archive(const char *filename) {
   }
 
   push_cleanup(cu_cidir, ~0, NULL, 0, 2, (void *)cidir, (void *)cidirrest);
-  c1 = subproc_fork();
-  if (!c1) {
+  pid = subproc_fork();
+  if (pid == 0) {
     cidirrest[-1] = '\0';
     execlp(BACKEND, BACKEND, "--control", filename, cidir, NULL);
     ohshite(_("unable to execute %s (%s)"),
             _("package control information extraction"), BACKEND);
   }
-  subproc_wait_check(c1, BACKEND " --control", 0);
+  subproc_wait_check(pid, BACKEND " --control", 0);
 
   /* We want to guarantee the extracted files are on the disk, so that the
    * subsequent renames to the info database do not end up with old or zero
@@ -641,8 +642,8 @@ void process_archive(const char *filename) {
 
   m_pipe(p1);
   push_cleanup(cu_closepipe, ehflag_bombout, NULL, 0, 1, (void *)&p1[0]);
-  c1 = subproc_fork();
-  if (!c1) {
+  pid = subproc_fork();
+  if (pid == 0) {
     m_dup2(p1[1],1); close(p1[0]); close(p1[1]);
     execlp(BACKEND, BACKEND, "--fsys-tarfile", filename, NULL);
     ohshite(_("unable to execute %s (%s)"),
@@ -668,7 +669,7 @@ void process_archive(const char *filename) {
   fd_null_copy(p1[0], -1, _("dpkg-deb: zap possible trailing zeros"));
   close(p1[0]);
   p1[0] = -1;
-  subproc_wait_check(c1, BACKEND " --fsys-tarfile", PROCPIPE);
+  subproc_wait_check(pid, BACKEND " --fsys-tarfile", PROCPIPE);
 
   tar_deferred_extract(newfileslist, pkg);