aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-01-30 14:21:49 +0100
committerChristian Grothoff <christian@grothoff.org>2021-01-30 14:21:49 +0100
commit0ad12329a7a4dc89ae63e8b032badf559b4f5550 (patch)
tree37134282e9288c90f6b3a41ea67cf99d6556470c
parentba1b54bd1346278b9f8674aa216ec2c7c16ad32c (diff)
downloadlibextractor-0ad12329a7a4dc89ae63e8b032badf559b4f5550.tar.gz
libextractor-0ad12329a7a4dc89ae63e8b032badf559b4f5550.zip
get rid of plibc.h
-rw-r--r--src/include/Makefile.am5
-rw-r--r--src/include/platform.h2
-rw-r--r--src/main/extract.c70
-rw-r--r--src/main/extractor.c3
-rw-r--r--src/main/extractor_datasource.c18
-rw-r--r--src/main/extractor_ipc_gnu.c3
-rw-r--r--src/main/extractor_ipc_w32.c2
-rw-r--r--src/main/extractor_plugin_main.c1
-rw-r--r--src/main/extractor_plugins.h1
-rw-r--r--src/main/extractor_plugpath.c17
-rw-r--r--src/main/test_bzip2.c2
-rw-r--r--src/main/test_file.c2
-rw-r--r--src/main/test_gzip.c2
-rw-r--r--src/main/test_ipc.c2
-rw-r--r--src/main/test_plugin_load_multi.c2
-rw-r--r--src/main/test_plugin_loading.c2
-rw-r--r--src/main/test_trivial.c2
-rwxr-xr-xsrc/plugins/fuzz_default.sh4
-rw-r--r--src/plugins/gif_extractor.c6
-rw-r--r--src/plugins/old/ebml_extractor.c6
-rw-r--r--src/plugins/rpm_extractor.c14
21 files changed, 79 insertions, 87 deletions
diff --git a/src/include/Makefile.am b/src/include/Makefile.am
index a81ffc2..db3dcf1 100644
--- a/src/include/Makefile.am
+++ b/src/include/Makefile.am
@@ -1,8 +1,7 @@
1# This Makefile.am is in the public domain 1# This Makefile.am is in the public domain
2SUBDIRS = . 2SUBDIRS = .
3include_HEADERS = \ 3include_HEADERS = \
4 extractor.h 4 extractor.h
5EXTRA_DIST = \ 5EXTRA_DIST = \
6 plibc.h \
7 platform.h \ 6 platform.h \
8 gettext.h 7 gettext.h
diff --git a/src/include/platform.h b/src/include/platform.h
index 9f72f57..b457a72 100644
--- a/src/include/platform.h
+++ b/src/include/platform.h
@@ -35,8 +35,6 @@
35#define _(a) dgettext ("org.gnunet.libextractor", a) 35#define _(a) dgettext ("org.gnunet.libextractor", a)
36#endif 36#endif
37 37
38#include "plibc.h"
39
40#include <string.h> 38#include <string.h>
41#include <unistd.h> 39#include <unistd.h>
42#include <ctype.h> 40#include <ctype.h>
diff --git a/src/main/extract.c b/src/main/extract.c
index 144f2c3..5efc53a 100644
--- a/src/main/extract.c
+++ b/src/main/extract.c
@@ -70,7 +70,7 @@ ignore_sigpipe ()
70 sig.sa_flags = SA_RESTART; 70 sig.sa_flags = SA_RESTART;
71#endif 71#endif
72 if (0 != sigaction (SIGPIPE, &sig, &oldsig)) 72 if (0 != sigaction (SIGPIPE, &sig, &oldsig))
73 FPRINTF (stderr, 73 fprintf (stderr,
74 "Failed to install SIGPIPE handler: %s\n", strerror (errno)); 74 "Failed to install SIGPIPE handler: %s\n", strerror (errno));
75} 75}
76 76
@@ -290,7 +290,7 @@ print_selected_keywords (void *cls,
290 if (YES != print[type]) 290 if (YES != print[type])
291 return 0; 291 return 0;
292 if (verbose > 3) 292 if (verbose > 3)
293 FPRINTF (stdout, 293 fprintf (stdout,
294 _ ("Found by `%s' plugin:\n"), 294 _ ("Found by `%s' plugin:\n"),
295 plugin_name); 295 plugin_name);
296 mt = EXTRACTOR_metatype_to_string (type); 296 mt = EXTRACTOR_metatype_to_string (type);
@@ -298,7 +298,7 @@ print_selected_keywords (void *cls,
298 switch (format) 298 switch (format)
299 { 299 {
300 case EXTRACTOR_METAFORMAT_UNKNOWN: 300 case EXTRACTOR_METAFORMAT_UNKNOWN:
301 FPRINTF (stdout, 301 fprintf (stdout,
302 _ ("%s - (unknown, %u bytes)\n"), 302 _ ("%s - (unknown, %u bytes)\n"),
303 stype, 303 stype,
304 (unsigned int) data_len); 304 (unsigned int) data_len);
@@ -317,7 +317,7 @@ print_selected_keywords (void *cls,
317 keyword = strdup (data); 317 keyword = strdup (data);
318 if (NULL != keyword) 318 if (NULL != keyword)
319 { 319 {
320 FPRINTF (stdout, 320 fprintf (stdout,
321 "%s - %s\n", 321 "%s - %s\n",
322 stype, 322 stype,
323 keyword); 323 keyword);
@@ -329,13 +329,13 @@ print_selected_keywords (void *cls,
329#endif 329#endif
330 break; 330 break;
331 case EXTRACTOR_METAFORMAT_BINARY: 331 case EXTRACTOR_METAFORMAT_BINARY:
332 FPRINTF (stdout, 332 fprintf (stdout,
333 _ ("%s - (binary, %u bytes)\n"), 333 _ ("%s - (binary, %u bytes)\n"),
334 stype, 334 stype,
335 (unsigned int) data_len); 335 (unsigned int) data_len);
336 break; 336 break;
337 case EXTRACTOR_METAFORMAT_C_STRING: 337 case EXTRACTOR_METAFORMAT_C_STRING:
338 FPRINTF (stdout, 338 fprintf (stdout,
339 "%s - %.*s\n", 339 "%s - %.*s\n",
340 stype, 340 stype,
341 (int) data_len, 341 (int) data_len,
@@ -392,7 +392,7 @@ print_selected_keywords_grep_friendly (void *cls,
392 if (0 == data_len) 392 if (0 == data_len)
393 return 0; 393 return 0;
394 if (verbose > 1) 394 if (verbose > 1)
395 FPRINTF (stdout, 395 fprintf (stdout,
396 "%s: ", 396 "%s: ",
397 gettext (mt)); 397 gettext (mt));
398#if HAVE_ICONV 398#if HAVE_ICONV
@@ -406,7 +406,7 @@ print_selected_keywords_grep_friendly (void *cls,
406 keyword = strdup (data); 406 keyword = strdup (data);
407 if (NULL != keyword) 407 if (NULL != keyword)
408 { 408 {
409 FPRINTF (stdout, 409 fprintf (stdout,
410 "`%s' ", 410 "`%s' ",
411 keyword); 411 keyword);
412 free (keyword); 412 free (keyword);
@@ -420,10 +420,10 @@ print_selected_keywords_grep_friendly (void *cls,
420 break; 420 break;
421 case EXTRACTOR_METAFORMAT_C_STRING: 421 case EXTRACTOR_METAFORMAT_C_STRING:
422 if (verbose > 1) 422 if (verbose > 1)
423 FPRINTF (stdout, 423 fprintf (stdout,
424 "%s ", 424 "%s ",
425 gettext (mt)); 425 gettext (mt));
426 FPRINTF (stdout, 426 fprintf (stdout,
427 "`%s'", 427 "`%s'",
428 data); 428 data);
429 break; 429 break;
@@ -575,7 +575,7 @@ finish_bibtex (const char *fn)
575 if ( (NULL == btm[0].value) || 575 if ( (NULL == btm[0].value) ||
576 (NULL == btm[1].value) || 576 (NULL == btm[1].value) ||
577 (NULL == btm[2].value) ) 577 (NULL == btm[2].value) )
578 FPRINTF (stdout, 578 fprintf (stdout,
579 "@%s %s { ", 579 "@%s %s { ",
580 et, 580 et,
581 fn); 581 fn);
@@ -592,18 +592,18 @@ finish_bibtex (const char *fn)
592 temp[n] = '_'; 592 temp[n] = '_';
593 else 593 else
594 temp[n] = tolower ( (unsigned char) temp[n]); 594 temp[n] = tolower ( (unsigned char) temp[n]);
595 FPRINTF (stdout, 595 fprintf (stdout,
596 "@%s %s { ", 596 "@%s %s { ",
597 et, 597 et,
598 temp); 598 temp);
599 } 599 }
600 for (i = 0; NULL != btm[i].bibTexName; i++) 600 for (i = 0; NULL != btm[i].bibTexName; i++)
601 if (NULL != btm[i].value) 601 if (NULL != btm[i].value)
602 FPRINTF (stdout, 602 fprintf (stdout,
603 "\t%s = {%s},\n", 603 "\t%s = {%s},\n",
604 btm[i].bibTexName, 604 btm[i].bibTexName,
605 btm[i].value); 605 btm[i].value);
606 FPRINTF (stdout, "%s", "}\n\n"); 606 fprintf (stdout, "%s", "}\n\n");
607} 607}
608 608
609 609
@@ -775,7 +775,7 @@ main (int argc, char *argv[])
775#endif 775#endif
776 if (NULL == (print = malloc (sizeof (int) * EXTRACTOR_metatype_get_max ()))) 776 if (NULL == (print = malloc (sizeof (int) * EXTRACTOR_metatype_get_max ())))
777 { 777 {
778 FPRINTF (stderr, 778 fprintf (stderr,
779 "malloc failed: %s\n", 779 "malloc failed: %s\n",
780 strerror (errno)); 780 strerror (errno));
781 return 1; 781 return 1;
@@ -785,7 +785,7 @@ main (int argc, char *argv[])
785 785
786 if (0 != _get_utf8_args (argc, argv, &utf8_argc, &utf8_argv)) 786 if (0 != _get_utf8_args (argc, argv, &utf8_argc, &utf8_argv))
787 { 787 {
788 FPRINTF (stderr, "Failed to get arguments: %s\n", strerror (errno)); 788 fprintf (stderr, "Failed to get arguments: %s\n", strerror (errno));
789 return 1; 789 return 1;
790 } 790 }
791 791
@@ -821,7 +821,7 @@ main (int argc, char *argv[])
821 bibtex = YES; 821 bibtex = YES;
822 if (NULL != processor) 822 if (NULL != processor)
823 { 823 {
824 FPRINTF (stderr, 824 fprintf (stderr,
825 "%s", 825 "%s",
826 _ ( 826 _ (
827 "Illegal combination of options, cannot combine multiple styles of printing.\n")); 827 "Illegal combination of options, cannot combine multiple styles of printing.\n"));
@@ -834,7 +834,7 @@ main (int argc, char *argv[])
834 grepfriendly = YES; 834 grepfriendly = YES;
835 if (NULL != processor) 835 if (NULL != processor)
836 { 836 {
837 FPRINTF (stderr, 837 fprintf (stderr,
838 "%s", 838 "%s",
839 _ ( 839 _ (
840 "Illegal combination of options, cannot combine multiple styles of printing.\n")); 840 "Illegal combination of options, cannot combine multiple styles of printing.\n"));
@@ -869,7 +869,7 @@ main (int argc, char *argv[])
869 case 'p': 869 case 'p':
870 if (NULL == optarg) 870 if (NULL == optarg)
871 { 871 {
872 FPRINTF (stderr, 872 fprintf (stderr,
873 _ ( 873 _ (
874 "You must specify an argument for the `%s' option (option ignored).\n"), 874 "You must specify an argument for the `%s' option (option ignored).\n"),
875 "-p"); 875 "-p");
@@ -898,7 +898,7 @@ main (int argc, char *argv[])
898 } 898 }
899 if (NULL == EXTRACTOR_metatype_to_string (i)) 899 if (NULL == EXTRACTOR_metatype_to_string (i))
900 { 900 {
901 FPRINTF (stderr, 901 fprintf (stderr,
902 "Unknown keyword type `%s', use option `%s' to get a list.\n", 902 "Unknown keyword type `%s', use option `%s' to get a list.\n",
903 optarg, 903 optarg,
904 "-L"); 904 "-L");
@@ -929,7 +929,7 @@ main (int argc, char *argv[])
929 } 929 }
930 if (NULL == EXTRACTOR_metatype_to_string (i)) 930 if (NULL == EXTRACTOR_metatype_to_string (i))
931 { 931 {
932 FPRINTF (stderr, 932 fprintf (stderr,
933 "Unknown keyword type `%s', use option `%s' to get a list.\n", 933 "Unknown keyword type `%s', use option `%s' to get a list.\n",
934 optarg, 934 optarg,
935 "-L"); 935 "-L");
@@ -938,7 +938,7 @@ main (int argc, char *argv[])
938 } 938 }
939 break; 939 break;
940 default: 940 default:
941 FPRINTF (stderr, 941 fprintf (stderr,
942 "%s", 942 "%s",
943 _ ("Use --help to get a list of options.\n")); 943 _ ("Use --help to get a list of options.\n"));
944 free (utf8_argv); 944 free (utf8_argv);
@@ -947,7 +947,7 @@ main (int argc, char *argv[])
947 } /* while (1) */ 947 } /* while (1) */
948 if (optind < 0) 948 if (optind < 0)
949 { 949 {
950 FPRINTF (stderr, 950 fprintf (stderr,
951 "%s", "Unknown error parsing options\n"); 951 "%s", "Unknown error parsing options\n");
952 free (print); 952 free (print);
953 free (utf8_argv); 953 free (utf8_argv);
@@ -955,7 +955,7 @@ main (int argc, char *argv[])
955 } 955 }
956 if (utf8_argc - optind < 1) 956 if (utf8_argc - optind < 1)
957 { 957 {
958 FPRINTF (stderr, 958 fprintf (stderr,
959 "%s", "Invoke with list of filenames to extract keywords form!\n"); 959 "%s", "Invoke with list of filenames to extract keywords form!\n");
960 free (print); 960 free (print);
961 free (utf8_argv); 961 free (utf8_argv);
@@ -980,15 +980,15 @@ main (int argc, char *argv[])
980 980
981 /* extract keywords */ 981 /* extract keywords */
982 if (YES == bibtex) 982 if (YES == bibtex)
983 FPRINTF (stdout, 983 fprintf (stdout,
984 "%s", _ ("% BiBTeX file\n")); 984 "%s", _ ("% BiBTeX file\n"));
985 for (i = optind; i < utf8_argc; i++) 985 for (i = optind; i < utf8_argc; i++)
986 { 986 {
987 errno = 0; 987 errno = 0;
988 if (YES == grepfriendly) 988 if (YES == grepfriendly)
989 FPRINTF (stdout, "%s ", utf8_argv[i]); 989 fprintf (stdout, "%s ", utf8_argv[i]);
990 else if (NO == bibtex) 990 else if (NO == bibtex)
991 FPRINTF (stdout, 991 fprintf (stdout,
992 _ ("Keywords for file %s:\n"), 992 _ ("Keywords for file %s:\n"),
993 utf8_argv[i]); 993 utf8_argv[i]);
994 else 994 else
@@ -1003,15 +1003,15 @@ main (int argc, char *argv[])
1003 { 1003 {
1004 struct stat sb; 1004 struct stat sb;
1005 unsigned char *data = NULL; 1005 unsigned char *data = NULL;
1006 int f = OPEN (utf8_argv[i], O_RDONLY 1006 int f = open (utf8_argv[i], O_RDONLY
1007#if WINDOWS 1007#if WINDOWS
1008 | O_BINARY 1008 | O_BINARY
1009#endif 1009#endif
1010 ); 1010 );
1011 if ( (-1 != f) && 1011 if ( (-1 != f) &&
1012 (0 == FSTAT (f, &sb)) && 1012 (0 == fstat (f, &sb)) &&
1013 (NULL != (data = malloc ((size_t) sb.st_size))) && 1013 (NULL != (data = malloc ((size_t) sb.st_size))) &&
1014 (sb.st_size == READ (f, data, (size_t) sb.st_size) ) ) 1014 (sb.st_size == read (f, data, (size_t) sb.st_size) ) )
1015 { 1015 {
1016 EXTRACTOR_extract (plugins, 1016 EXTRACTOR_extract (plugins,
1017 NULL, 1017 NULL,
@@ -1022,7 +1022,7 @@ main (int argc, char *argv[])
1022 else 1022 else
1023 { 1023 {
1024 if (verbose > 0) 1024 if (verbose > 0)
1025 FPRINTF (stderr, 1025 fprintf (stderr,
1026 "%s: %s: %s\n", 1026 "%s: %s: %s\n",
1027 utf8_argv[0], utf8_argv[i], strerror (errno)); 1027 utf8_argv[0], utf8_argv[i], strerror (errno));
1028 ret = 1; 1028 ret = 1;
@@ -1030,18 +1030,18 @@ main (int argc, char *argv[])
1030 if (NULL != data) 1030 if (NULL != data)
1031 free (data); 1031 free (data);
1032 if (-1 != f) 1032 if (-1 != f)
1033 (void) CLOSE (f); 1033 (void) close (f);
1034 } 1034 }
1035 if (YES == grepfriendly) 1035 if (YES == grepfriendly)
1036 FPRINTF (stdout, "%s", "\n"); 1036 fprintf (stdout, "%s", "\n");
1037 continue; 1037 continue;
1038 } 1038 }
1039 if (YES == grepfriendly) 1039 if (YES == grepfriendly)
1040 FPRINTF (stdout, "%s", "\n"); 1040 fprintf (stdout, "%s", "\n");
1041 if (bibtex) 1041 if (bibtex)
1042 finish_bibtex (utf8_argv[i]); 1042 finish_bibtex (utf8_argv[i]);
1043 if (verbose > 0) 1043 if (verbose > 0)
1044 FPRINTF (stdout, "%s", "\n"); 1044 fprintf (stdout, "%s", "\n");
1045 free (print); 1045 free (print);
1046 free (utf8_argv); 1046 free (utf8_argv);
1047 EXTRACTOR_plugin_remove_all (plugins); 1047 EXTRACTOR_plugin_remove_all (plugins);
diff --git a/src/main/extractor.c b/src/main/extractor.c
index 89d734d..defa229 100644
--- a/src/main/extractor.c
+++ b/src/main/extractor.c
@@ -19,7 +19,6 @@
19 */ 19 */
20 20
21#include "platform.h" 21#include "platform.h"
22#include "plibc.h"
23#include "extractor.h" 22#include "extractor.h"
24#include <dirent.h> 23#include <dirent.h>
25#include <sys/types.h> 24#include <sys/types.h>
@@ -670,7 +669,7 @@ EXTRACTOR_ltdl_init ()
670 int err; 669 int err;
671 670
672#if ENABLE_NLS 671#if ENABLE_NLS
673 BINDTEXTDOMAIN (PACKAGE, LOCALEDIR); 672 bindtextdomain (PACKAGE, LOCALEDIR);
674#endif 673#endif
675 err = lt_dlinit (); 674 err = lt_dlinit ();
676 if (err > 0) 675 if (err > 0)
diff --git a/src/main/extractor_datasource.c b/src/main/extractor_datasource.c
index 0b18d7c..9f51d90 100644
--- a/src/main/extractor_datasource.c
+++ b/src/main/extractor_datasource.c
@@ -229,7 +229,7 @@ bfds_pick_next_buffer_at (struct BufferedFileDataSource *bfds,
229 bfds->buffer_pos = pos; 229 bfds->buffer_pos = pos;
230 return 0; 230 return 0;
231 } 231 }
232 position = (int64_t) LSEEK (bfds->fd, pos, SEEK_SET); 232 position = (int64_t) lseek (bfds->fd, pos, SEEK_SET);
233 if (position < 0) 233 if (position < 0)
234 { 234 {
235 LOG_STRERROR ("lseek"); 235 LOG_STRERROR ("lseek");
@@ -1214,38 +1214,38 @@ EXTRACTOR_datasource_create_from_file_ (const char *filename,
1214 winmode = O_BINARY; 1214 winmode = O_BINARY;
1215#endif 1215#endif
1216 1216
1217 if (-1 == (fd = OPEN (filename, O_RDONLY | O_LARGEFILE | winmode))) 1217 if (-1 == (fd = open (filename, O_RDONLY | O_LARGEFILE | winmode)))
1218 { 1218 {
1219 LOG_STRERROR_FILE ("open", filename); 1219 LOG_STRERROR_FILE ("open", filename);
1220 return NULL; 1220 return NULL;
1221 } 1221 }
1222 if ( (0 != FSTAT (fd, &sb)) || 1222 if ( (0 != fstat (fd, &sb)) ||
1223 (S_ISDIR (sb.st_mode)) ) 1223 (S_ISDIR (sb.st_mode)) )
1224 { 1224 {
1225 if (! S_ISDIR (sb.st_mode)) 1225 if (! S_ISDIR (sb.st_mode))
1226 LOG_STRERROR_FILE ("fstat", filename); 1226 LOG_STRERROR_FILE ("fstat", filename);
1227 else 1227 else
1228 LOG ("Skipping directory `%s'\n", filename); 1228 LOG ("Skipping directory `%s'\n", filename);
1229 (void) CLOSE (fd); 1229 (void) close (fd);
1230 return NULL; 1230 return NULL;
1231 } 1231 }
1232 fsize = (int64_t) sb.st_size; 1232 fsize = (int64_t) sb.st_size;
1233 if (0 == fsize) 1233 if (0 == fsize)
1234 { 1234 {
1235 (void) CLOSE (fd); 1235 (void) close (fd);
1236 return NULL; 1236 return NULL;
1237 } 1237 }
1238 bfds = bfds_new (NULL, fd, fsize); 1238 bfds = bfds_new (NULL, fd, fsize);
1239 if (NULL == bfds) 1239 if (NULL == bfds)
1240 { 1240 {
1241 (void) CLOSE (fd); 1241 (void) close (fd);
1242 return NULL; 1242 return NULL;
1243 } 1243 }
1244 if (NULL == (ds = malloc (sizeof (struct EXTRACTOR_Datasource)))) 1244 if (NULL == (ds = malloc (sizeof (struct EXTRACTOR_Datasource))))
1245 { 1245 {
1246 LOG_STRERROR ("malloc"); 1246 LOG_STRERROR ("malloc");
1247 bfds_delete (bfds); 1247 bfds_delete (bfds);
1248 (void) CLOSE (fd); 1248 (void) close (fd);
1249 return NULL; 1249 return NULL;
1250 } 1250 }
1251 ds->bfds = bfds; 1251 ds->bfds = bfds;
@@ -1261,7 +1261,7 @@ EXTRACTOR_datasource_create_from_file_ (const char *filename,
1261 LOG ("Failed to initialize decompressor\n"); 1261 LOG ("Failed to initialize decompressor\n");
1262 bfds_delete (bfds); 1262 bfds_delete (bfds);
1263 free (ds); 1263 free (ds);
1264 (void) CLOSE (fd); 1264 (void) close (fd);
1265 return NULL; 1265 return NULL;
1266 } 1266 }
1267 } 1267 }
@@ -1333,7 +1333,7 @@ EXTRACTOR_datasource_destroy_ (struct EXTRACTOR_Datasource *ds)
1333 cfs_destroy (ds->cfs); 1333 cfs_destroy (ds->cfs);
1334 bfds_delete (ds->bfds); 1334 bfds_delete (ds->bfds);
1335 if (-1 != ds->fd) 1335 if (-1 != ds->fd)
1336 (void) CLOSE (ds->fd); 1336 (void) close (ds->fd);
1337 free (ds); 1337 free (ds);
1338} 1338}
1339 1339
diff --git a/src/main/extractor_ipc_gnu.c b/src/main/extractor_ipc_gnu.c
index 06e4a1b..4bb5869 100644
--- a/src/main/extractor_ipc_gnu.c
+++ b/src/main/extractor_ipc_gnu.c
@@ -23,7 +23,6 @@
23 * @author Christian Grothoff 23 * @author Christian Grothoff
24 */ 24 */
25#include "platform.h" 25#include "platform.h"
26#include "plibc.h"
27#include "extractor.h" 26#include "extractor.h"
28#include "extractor_datasource.h" 27#include "extractor_datasource.h"
29#include "extractor_logging.h" 28#include "extractor_logging.h"
@@ -155,7 +154,7 @@ EXTRACTOR_IPC_shared_memory_create_ (size_t size)
155 "%sLE-%u-%u", 154 "%sLE-%u-%u",
156 tpath, 155 tpath,
157 getpid (), 156 getpid (),
158 (unsigned int) RANDOM ()); 157 (unsigned int) random ());
159 if (-1 == (shm->shm_id = shm_open (shm->shm_name, 158 if (-1 == (shm->shm_id = shm_open (shm->shm_name,
160 O_RDWR | O_CREAT, 159 O_RDWR | O_CREAT,
161 S_IRUSR | S_IWUSR))) 160 S_IRUSR | S_IWUSR)))
diff --git a/src/main/extractor_ipc_w32.c b/src/main/extractor_ipc_w32.c
index b53bc3c..8749da9 100644
--- a/src/main/extractor_ipc_w32.c
+++ b/src/main/extractor_ipc_w32.c
@@ -162,7 +162,7 @@ EXTRACTOR_IPC_shared_memory_create_ (size_t size)
162 snprintf (shm->shm_name, MAX_SHM_NAME, 162 snprintf (shm->shm_name, MAX_SHM_NAME,
163 "%slibextractor-shm-%u-%u", 163 "%slibextractor-shm-%u-%u",
164 tpath, getpid (), 164 tpath, getpid (),
165 (unsigned int) RANDOM ()); 165 (unsigned int) random ());
166 shm->map = CreateFileMapping (INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, 166 shm->map = CreateFileMapping (INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0,
167 size, shm->shm_name); 167 size, shm->shm_name);
168 shm->ptr = MapViewOfFile (shm->map, FILE_MAP_WRITE, 0, 0, size); 168 shm->ptr = MapViewOfFile (shm->map, FILE_MAP_WRITE, 0, 0, size);
diff --git a/src/main/extractor_plugin_main.c b/src/main/extractor_plugin_main.c
index ee51c8f..409290d 100644
--- a/src/main/extractor_plugin_main.c
+++ b/src/main/extractor_plugin_main.c
@@ -23,7 +23,6 @@
23 * @author Christian Grothoff 23 * @author Christian Grothoff
24 */ 24 */
25#include "platform.h" 25#include "platform.h"
26#include "plibc.h"
27#include "extractor.h" 26#include "extractor.h"
28#include "extractor_common.h" 27#include "extractor_common.h"
29#include "extractor_datasource.h" 28#include "extractor_datasource.h"
diff --git a/src/main/extractor_plugins.h b/src/main/extractor_plugins.h
index 8b0f5e6..b362d43 100644
--- a/src/main/extractor_plugins.h
+++ b/src/main/extractor_plugins.h
@@ -26,7 +26,6 @@
26#define EXTRACTOR_PLUGINS_H 26#define EXTRACTOR_PLUGINS_H
27 27
28#include "platform.h" 28#include "platform.h"
29#include "plibc.h"
30#include "extractor.h" 29#include "extractor.h"
31#include <signal.h> 30#include <signal.h>
32#include <ltdl.h> 31#include <ltdl.h>
diff --git a/src/main/extractor_plugpath.c b/src/main/extractor_plugpath.c
index 4374bc5..269061f 100644
--- a/src/main/extractor_plugpath.c
+++ b/src/main/extractor_plugpath.c
@@ -24,7 +24,6 @@
24 */ 24 */
25 25
26#include "platform.h" 26#include "platform.h"
27#include "plibc.h"
28#include "extractor.h" 27#include "extractor.h"
29#include <dirent.h> 28#include <dirent.h>
30#include <sys/types.h> 29#include <sys/types.h>
@@ -103,7 +102,7 @@ get_path_from_proc_exe ()
103 sizeof (fn), 102 sizeof (fn),
104 "/proc/%u/maps", 103 "/proc/%u/maps",
105 getpid ()); 104 getpid ());
106 if (NULL != (f = FOPEN (fn, "r"))) 105 if (NULL != (f = fopen (fn, "r")))
107 { 106 {
108 while (NULL != fgets (line, 1024, f)) 107 while (NULL != fgets (line, 1024, f))
109 { 108 {
@@ -419,7 +418,7 @@ append_to_dir (const char *path,
419 418
420 if (0 == (slen = strlen (path))) 419 if (0 == (slen = strlen (path)))
421 return NULL; 420 return NULL;
422 if (DIR_SEPARATOR == fname[0]) 421 if ('/' == fname[0])
423 fname++; 422 fname++;
424 ret = malloc (slen + strlen (fname) + 2); 423 ret = malloc (slen + strlen (fname) + 2);
425 if (NULL == ret) 424 if (NULL == ret)
@@ -476,9 +475,9 @@ get_installation_paths (EXTRACTOR_PathProcessor pp,
476 LOG_STRERROR ("strdup"); 475 LOG_STRERROR ("strdup");
477 return; 476 return;
478 } 477 }
479 for (prefix = strtok_r (d, PATH_SEPARATOR_STR, &saveptr); 478 for (prefix = strtok_r (d, ":", &saveptr);
480 NULL != prefix; 479 NULL != prefix;
481 prefix = strtok_r (NULL, PATH_SEPARATOR_STR, &saveptr)) 480 prefix = strtok_r (NULL, ":", &saveptr))
482 pp (pp_cls, prefix); 481 pp (pp_cls, prefix);
483 free (d); 482 free (d);
484 return; 483 return;
@@ -551,9 +550,9 @@ find_plugin_in_path (void *cls,
551 550
552 if (NULL != sc->path) 551 if (NULL != sc->path)
553 return; 552 return;
554 if (NULL == (dir = OPENDIR (path))) 553 if (NULL == (dir = opendir (path)))
555 return; 554 return;
556 while (NULL != (ent = READDIR (dir))) 555 while (NULL != (ent = readdir (dir)))
557 { 556 {
558 if ('.' == ent->d_name[0]) 557 if ('.' == ent->d_name[0])
559 continue; 558 continue;
@@ -568,7 +567,7 @@ find_plugin_in_path (void *cls,
568 if (NULL == (sym = strdup (sym_name))) 567 if (NULL == (sym = strdup (sym_name)))
569 { 568 {
570 LOG_STRERROR ("strdup"); 569 LOG_STRERROR ("strdup");
571 CLOSEDIR (dir); 570 closedir (dir);
572 return; 571 return;
573 } 572 }
574 dot = strchr (sym, '.'); 573 dot = strchr (sym, '.');
@@ -582,7 +581,7 @@ find_plugin_in_path (void *cls,
582 } 581 }
583 free (sym); 582 free (sym);
584 } 583 }
585 CLOSEDIR (dir); 584 closedir (dir);
586} 585}
587 586
588 587
diff --git a/src/main/test_bzip2.c b/src/main/test_bzip2.c
index 598e913..1c4c9d3 100644
--- a/src/main/test_bzip2.c
+++ b/src/main/test_bzip2.c
@@ -135,7 +135,7 @@ main (int argc, char *argv[])
135 /* change environment to find 'extractor_test' plugin which is 135 /* change environment to find 'extractor_test' plugin which is
136 not installed but should be in the current directory (or .libs) 136 not installed but should be in the current directory (or .libs)
137 on 'make check' */ 137 on 'make check' */
138 if (0 != putenv ("LIBEXTRACTOR_PREFIX=." PATH_SEPARATOR_STR ".libs/")) 138 if (0 != putenv ("LIBEXTRACTOR_PREFIX=.:.libs/"))
139 fprintf (stderr, 139 fprintf (stderr,
140 "Failed to update my environment, plugin loading may fail: %s\n", 140 "Failed to update my environment, plugin loading may fail: %s\n",
141 strerror (errno)); 141 strerror (errno));
diff --git a/src/main/test_file.c b/src/main/test_file.c
index a2d6a5e..83681f7 100644
--- a/src/main/test_file.c
+++ b/src/main/test_file.c
@@ -135,7 +135,7 @@ main (int argc, char *argv[])
135 /* change environment to find 'extractor_test' plugin which is 135 /* change environment to find 'extractor_test' plugin which is
136 not installed but should be in the current directory (or .libs) 136 not installed but should be in the current directory (or .libs)
137 on 'make check' */ 137 on 'make check' */
138 if (0 != putenv ("LIBEXTRACTOR_PREFIX=." PATH_SEPARATOR_STR ".libs/")) 138 if (0 != putenv ("LIBEXTRACTOR_PREFIX=.:.libs/"))
139 fprintf (stderr, 139 fprintf (stderr,
140 "Failed to update my environment, plugin loading may fail: %s\n", 140 "Failed to update my environment, plugin loading may fail: %s\n",
141 strerror (errno)); 141 strerror (errno));
diff --git a/src/main/test_gzip.c b/src/main/test_gzip.c
index 071c74c..5b29ac1 100644
--- a/src/main/test_gzip.c
+++ b/src/main/test_gzip.c
@@ -139,7 +139,7 @@ main (int argc, char *argv[])
139 /* change environment to find 'extractor_test' plugin which is 139 /* change environment to find 'extractor_test' plugin which is
140 not installed but should be in the current directory (or .libs) 140 not installed but should be in the current directory (or .libs)
141 on 'make check' */ 141 on 'make check' */
142 if (0 != putenv ("LIBEXTRACTOR_PREFIX=." PATH_SEPARATOR_STR ".libs/")) 142 if (0 != putenv ("LIBEXTRACTOR_PREFIX=.:.libs/"))
143 fprintf (stderr, 143 fprintf (stderr,
144 "Failed to update my environment, plugin loading may fail: %s\n", 144 "Failed to update my environment, plugin loading may fail: %s\n",
145 strerror (errno)); 145 strerror (errno));
diff --git a/src/main/test_ipc.c b/src/main/test_ipc.c
index 4da3ef5..1ef23f0 100644
--- a/src/main/test_ipc.c
+++ b/src/main/test_ipc.c
@@ -145,7 +145,7 @@ main (int argc, char *argv[])
145 /* change environment to find 'extractor_test' plugin which is 145 /* change environment to find 'extractor_test' plugin which is
146 not installed but should be in the current directory (or .libs) 146 not installed but should be in the current directory (or .libs)
147 on 'make check' */ 147 on 'make check' */
148 if (0 != putenv ("LIBEXTRACTOR_PREFIX=." PATH_SEPARATOR_STR ".libs/")) 148 if (0 != putenv ("LIBEXTRACTOR_PREFIX=.:.libs/"))
149 fprintf (stderr, 149 fprintf (stderr,
150 "Failed to update my environment, plugin loading may fail: %s\n", 150 "Failed to update my environment, plugin loading may fail: %s\n",
151 strerror (errno)); 151 strerror (errno));
diff --git a/src/main/test_plugin_load_multi.c b/src/main/test_plugin_load_multi.c
index 6b30390..18b3e64 100644
--- a/src/main/test_plugin_load_multi.c
+++ b/src/main/test_plugin_load_multi.c
@@ -60,7 +60,7 @@ main (int argc, char *argv[])
60 /* change environment to find 'extractor_test' plugin which is 60 /* change environment to find 'extractor_test' plugin which is
61 not installed but should be in the current directory (or .libs) 61 not installed but should be in the current directory (or .libs)
62 on 'make check' */ 62 on 'make check' */
63 if (0 != putenv ("LIBEXTRACTOR_PREFIX=." PATH_SEPARATOR_STR ".libs/")) 63 if (0 != putenv ("LIBEXTRACTOR_PREFIX=.:.libs/"))
64 fprintf (stderr, 64 fprintf (stderr,
65 "Failed to update my environment, plugin loading may fail: %s\n", 65 "Failed to update my environment, plugin loading may fail: %s\n",
66 strerror (errno)); 66 strerror (errno));
diff --git a/src/main/test_plugin_loading.c b/src/main/test_plugin_loading.c
index 537b703..708c76c 100644
--- a/src/main/test_plugin_loading.c
+++ b/src/main/test_plugin_loading.c
@@ -33,7 +33,7 @@ main (int argc, char *argv[])
33 /* change environment to find 'extractor_test' plugin which is 33 /* change environment to find 'extractor_test' plugin which is
34 not installed but should be in the current directory (or .libs) 34 not installed but should be in the current directory (or .libs)
35 on 'make check' */ 35 on 'make check' */
36 if (0 != putenv ("LIBEXTRACTOR_PREFIX=." PATH_SEPARATOR_STR ".libs/")) 36 if (0 != putenv ("LIBEXTRACTOR_PREFIX=.:.libs/"))
37 fprintf (stderr, 37 fprintf (stderr,
38 "Failed to update my environment, plugin loading may fail: %s\n", 38 "Failed to update my environment, plugin loading may fail: %s\n",
39 strerror (errno)); 39 strerror (errno));
diff --git a/src/main/test_trivial.c b/src/main/test_trivial.c
index b0860b4..ce0e7d5 100644
--- a/src/main/test_trivial.c
+++ b/src/main/test_trivial.c
@@ -51,7 +51,7 @@ main (int argc, char *argv[])
51 /* change environment to find 'extractor_test' plugin which is 51 /* change environment to find 'extractor_test' plugin which is
52 not installed but should be in the current directory (or .libs) 52 not installed but should be in the current directory (or .libs)
53 on 'make check' */ 53 on 'make check' */
54 if (0 != putenv ("LIBEXTRACTOR_PREFIX=." PATH_SEPARATOR_STR ".libs/")) 54 if (0 != putenv ("LIBEXTRACTOR_PREFIX=.:.libs/"))
55 fprintf (stderr, 55 fprintf (stderr,
56 "Failed to update my environment, plugin loading may fail: %s\n", 56 "Failed to update my environment, plugin loading may fail: %s\n",
57 strerror (errno)); 57 strerror (errno));
diff --git a/src/plugins/fuzz_default.sh b/src/plugins/fuzz_default.sh
index c404723..7418dff 100755
--- a/src/plugins/fuzz_default.sh
+++ b/src/plugins/fuzz_default.sh
@@ -6,11 +6,11 @@ ZZSTARTSEED=0
6ZZSTOPSEED=100 6ZZSTOPSEED=100
7ret=0 7ret=0
8# fallbacks for direct, non-"make check" usage 8# fallbacks for direct, non-"make check" usage
9if test x"$testdatadir" = x"" 9if test x"${testdatadir:-NONE}" = xNONE""
10then 10then
11 testdatadir=../../test 11 testdatadir=../../test
12fi 12fi
13if test x"$bindir" = x"" 13if test x"${bindir:-NONE}" = xNONE""
14then 14then
15 bindir=`grep "^prefix = " ./Makefile | cut -d ' ' -f 3` 15 bindir=`grep "^prefix = " ./Makefile | cut -d ' ' -f 3`
16 bindir="$bindir/bin" 16 bindir="$bindir/bin"
diff --git a/src/plugins/gif_extractor.c b/src/plugins/gif_extractor.c
index 405eebe..3b202b5 100644
--- a/src/plugins/gif_extractor.c
+++ b/src/plugins/gif_extractor.c
@@ -36,7 +36,7 @@
36 * @return -1 on error, otherwise number of bytes read 36 * @return -1 on error, otherwise number of bytes read
37 */ 37 */
38static int 38static int
39gif_read_func (GifFileType *ft, 39gif_READ_func (GifFileType *ft,
40 GifByteType *bt, 40 GifByteType *bt,
41 int arg) 41 int arg)
42{ 42{
@@ -68,13 +68,13 @@ EXTRACTOR_gif_extract_method (struct EXTRACTOR_ExtractContext *ec)
68 int et; 68 int et;
69 char dims[128]; 69 char dims[128];
70#if defined (GIF_LIB_VERSION) || GIFLIB_MAJOR <= 4 70#if defined (GIF_LIB_VERSION) || GIFLIB_MAJOR <= 4
71 if (NULL == (gif_file = DGifOpen (ec, &gif_read_func))) 71 if (NULL == (gif_file = DGifOpen (ec, &gif_READ_func)))
72 return; /* not a GIF */ 72 return; /* not a GIF */
73#else 73#else
74 int gif_error; 74 int gif_error;
75 75
76 gif_error = 0; 76 gif_error = 0;
77 gif_file = DGifOpen (ec, &gif_read_func, &gif_error); 77 gif_file = DGifOpen (ec, &gif_READ_func, &gif_error);
78 if ((gif_file == NULL) || (gif_error != 0)) 78 if ((gif_file == NULL) || (gif_error != 0))
79 { 79 {
80 if (gif_file != NULL) 80 if (gif_file != NULL)
diff --git a/src/plugins/old/ebml_extractor.c b/src/plugins/old/ebml_extractor.c
index f7daa9a..0d4fc91 100644
--- a/src/plugins/old/ebml_extractor.c
+++ b/src/plugins/old/ebml_extractor.c
@@ -734,7 +734,7 @@ struct ebml_state
734 int reported_ebml; 734 int reported_ebml;
735 int valid_ebml; 735 int valid_ebml;
736 uint64_t ebml_version; 736 uint64_t ebml_version;
737 uint64_t ebml_read_version; 737 uint64_t ebml_READ_version;
738 uint64_t ebml_max_id_length; 738 uint64_t ebml_max_id_length;
739 uint64_t ebml_max_size_length; 739 uint64_t ebml_max_size_length;
740 char *doctype; 740 char *doctype;
@@ -796,7 +796,7 @@ clean_ebml_state_ebml (struct ebml_state *state)
796 state->reported_ebml = 0; 796 state->reported_ebml = 0;
797 state->valid_ebml = 0; 797 state->valid_ebml = 0;
798 state->ebml_version = 1; 798 state->ebml_version = 1;
799 state->ebml_read_version = 1; 799 state->ebml_READ_version = 1;
800 state->ebml_max_id_length = 4; 800 state->ebml_max_id_length = 4;
801 state->ebml_max_size_length = 8; 801 state->ebml_max_size_length = 8;
802 state->doctype = NULL; 802 state->doctype = NULL;
@@ -1699,7 +1699,7 @@ EXTRACTOR_ebml_extract_method (struct EXTRACTOR_PluginList *plugin,
1699 state->ebml_version = uint_value; 1699 state->ebml_version = uint_value;
1700 break; 1700 break;
1701 case EBMLID_READ_VERSION: 1701 case EBMLID_READ_VERSION:
1702 state->ebml_read_version = uint_value; 1702 state->ebml_READ_version = uint_value;
1703 if (uint_value > 1) 1703 if (uint_value > 1)
1704 { 1704 {
1705 /* We don't support EBML versions > 1 */ 1705 /* We don't support EBML versions > 1 */
diff --git a/src/plugins/rpm_extractor.c b/src/plugins/rpm_extractor.c
index 90c5892..248217a 100644
--- a/src/plugins/rpm_extractor.c
+++ b/src/plugins/rpm_extractor.c
@@ -106,7 +106,7 @@ pipe_feeder (void *args)
106 while ( (0 == p->shutdown) && 106 while ( (0 == p->shutdown) &&
107 (done < rret) ) 107 (done < rret) )
108 { 108 {
109 if (-1 == (wret = WRITE (p->pi[1], 109 if (-1 == (wret = write (p->pi[1],
110 &buf[done], 110 &buf[done],
111 rret - done))) 111 rret - done)))
112 { 112 {
@@ -119,7 +119,7 @@ pipe_feeder (void *args)
119 if (done != rret) 119 if (done != rret)
120 break; 120 break;
121 } 121 }
122 CLOSE (p->pi[1]); 122 close (p->pi[1]);
123 return NULL; 123 return NULL;
124} 124}
125 125
@@ -272,8 +272,8 @@ EXTRACTOR_rpm_extract_method (struct EXTRACTOR_ExtractContext *ec)
272 return; 272 return;
273 if (0 != pthread_mutex_init (&parg.lock, NULL)) 273 if (0 != pthread_mutex_init (&parg.lock, NULL))
274 { 274 {
275 CLOSE (parg.pi[0]); 275 close (parg.pi[0]);
276 CLOSE (parg.pi[1]); 276 close (parg.pi[1]);
277 return; 277 return;
278 } 278 }
279 if (0 != pthread_create (&pthr, 279 if (0 != pthread_create (&pthr,
@@ -282,8 +282,8 @@ EXTRACTOR_rpm_extract_method (struct EXTRACTOR_ExtractContext *ec)
282 &parg)) 282 &parg))
283 { 283 {
284 pthread_mutex_destroy (&parg.lock); 284 pthread_mutex_destroy (&parg.lock);
285 CLOSE (parg.pi[0]); 285 close (parg.pi[0]);
286 CLOSE (parg.pi[1]); 286 close (parg.pi[1]);
287 return; 287 return;
288 } 288 }
289 rpmlogSetCallback (&discard_log_callback, NULL); 289 rpmlogSetCallback (&discard_log_callback, NULL);
@@ -416,7 +416,7 @@ END:
416 sig.sa_handler = SIG_IGN; 416 sig.sa_handler = SIG_IGN;
417 sigaction (SIGALRM, &sig, &old); 417 sigaction (SIGALRM, &sig, &old);
418 parg.shutdown = 1; 418 parg.shutdown = 1;
419 CLOSE (parg.pi[0]); 419 close (parg.pi[0]);
420 Fclose (fdi); 420 Fclose (fdi);
421 pthread_kill (pthr, SIGALRM); 421 pthread_kill (pthr, SIGALRM);
422 pthread_join (pthr, &unused); 422 pthread_join (pthr, &unused);