"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/plugins/rpm_extractor.c" between
libextractor-1.10.tar.gz and libextractor-1.11.tar.gz

About: GNU libextractor is a library used to extract meta-data from files of arbitrary type.

rpm_extractor.c  (libextractor-1.10):rpm_extractor.c  (libextractor-1.11)
skipping to change at line 106 skipping to change at line 106
break; break;
} }
pthread_mutex_unlock (&p->lock); pthread_mutex_unlock (&p->lock);
if (0 == rret) if (0 == rret)
break; break;
buf = ptr; buf = ptr;
done = 0; done = 0;
while ( (0 == p->shutdown) && while ( (0 == p->shutdown) &&
(done < rret) ) (done < rret) )
{ {
if (-1 == (wret = WRITE (p->pi[1], if (-1 == (wret = write (p->pi[1],
&buf[done], &buf[done],
rret - done))) rret - done)))
{ {
break; break;
} }
if (0 == wret) if (0 == wret)
break; break;
done += wret; done += wret;
} }
if (done != rret) if (done != rret)
break; break;
} }
CLOSE (p->pi[1]); close (p->pi[1]);
return NULL; return NULL;
} }
/** /**
* LOG callback called by librpm. Does nothing, we * LOG callback called by librpm. Does nothing, we
* just need this to override the default behavior. * just need this to override the default behavior.
*/ */
static int static int
discard_log_callback (rpmlogRec rec, discard_log_callback (rpmlogRec rec,
void *ctx) void *ctx)
skipping to change at line 268 skipping to change at line 268
/* FIXME: here it might be worthwhile to do some minimal /* FIXME: here it might be worthwhile to do some minimal
check to see if this is actually an RPM before we go check to see if this is actually an RPM before we go
and create a pipe and a thread for nothing... */ and create a pipe and a thread for nothing... */
parg.ec = ec; parg.ec = ec;
parg.shutdown = 0; parg.shutdown = 0;
if (0 != pipe (parg.pi)) if (0 != pipe (parg.pi))
return; return;
if (0 != pthread_mutex_init (&parg.lock, NULL)) if (0 != pthread_mutex_init (&parg.lock, NULL))
{ {
CLOSE (parg.pi[0]); close (parg.pi[0]);
CLOSE (parg.pi[1]); close (parg.pi[1]);
return; return;
} }
if (0 != pthread_create (&pthr, if (0 != pthread_create (&pthr,
NULL, NULL,
&pipe_feeder, &pipe_feeder,
&parg)) &parg))
{ {
pthread_mutex_destroy (&parg.lock); pthread_mutex_destroy (&parg.lock);
CLOSE (parg.pi[0]); close (parg.pi[0]);
CLOSE (parg.pi[1]); close (parg.pi[1]);
return; return;
} }
rpmlogSetCallback (&discard_log_callback, NULL); rpmlogSetCallback (&discard_log_callback, NULL);
fdi = fdDup (parg.pi[0]); fdi = fdDup (parg.pi[0]);
ts = rpmtsCreate (); ts = rpmtsCreate ();
rc = rpmReadPackageFile (ts, fdi, "GNU libextractor", &hdr); rc = rpmReadPackageFile (ts, fdi, "GNU libextractor", &hdr);
switch (rc) switch (rc)
{ {
case RPMRC_OK: case RPMRC_OK:
case RPMRC_NOKEY: case RPMRC_NOKEY:
skipping to change at line 412 skipping to change at line 412
rpmtsFree (ts); rpmtsFree (ts);
/* make sure SIGALRM does not kill us, then use it to /* make sure SIGALRM does not kill us, then use it to
kill the thread */ kill the thread */
memset (&sig, 0, sizeof (struct sigaction)); memset (&sig, 0, sizeof (struct sigaction));
memset (&old, 0, sizeof (struct sigaction)); memset (&old, 0, sizeof (struct sigaction));
sig.sa_flags = SA_NODEFER; sig.sa_flags = SA_NODEFER;
sig.sa_handler = SIG_IGN; sig.sa_handler = SIG_IGN;
sigaction (SIGALRM, &sig, &old); sigaction (SIGALRM, &sig, &old);
parg.shutdown = 1; parg.shutdown = 1;
CLOSE (parg.pi[0]); close (parg.pi[0]);
Fclose (fdi); Fclose (fdi);
pthread_kill (pthr, SIGALRM); pthread_kill (pthr, SIGALRM);
pthread_join (pthr, &unused); pthread_join (pthr, &unused);
pthread_mutex_destroy (&parg.lock); pthread_mutex_destroy (&parg.lock);
sigaction (SIGALRM, &old, &sig); sigaction (SIGALRM, &old, &sig);
} }
/* end of rpm_extractor.c */ /* end of rpm_extractor.c */
 End of changes. 5 change blocks. 
7 lines changed or deleted 7 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)