aboutsummaryrefslogtreecommitdiffstats
path: root/sysutils
diff options
context:
space:
mode:
authorehaupt <ehaupt@FreeBSD.org>2010-04-15 03:04:01 +0800
committerehaupt <ehaupt@FreeBSD.org>2010-04-15 03:04:01 +0800
commit71973e5869571a72a6596867fe3a40fe05f8a4e1 (patch)
treeec4a7295f24225880a997571a87d651ad0cfb5ac /sysutils
parent85909742ac99ace3691697f02fe0a92b806bd09d (diff)
downloadfreebsd-ports-gnome-71973e5869571a72a6596867fe3a40fe05f8a4e1.tar.gz
freebsd-ports-gnome-71973e5869571a72a6596867fe3a40fe05f8a4e1.tar.zst
freebsd-ports-gnome-71973e5869571a72a6596867fe3a40fe05f8a4e1.zip
- Fix several dangerous bugs as well as a few warnings
- Regenerate the Lex and Yacc C-files from their .l and .y sources instead of using, what the author built on his system in 2001. - Use FreeBSD's getopt function(s) instead of those bundled with the source. - Bump PORTREVISION Submitted by: mi
Diffstat (limited to 'sysutils')
-rw-r--r--sysutils/fatback/Makefile6
-rw-r--r--sysutils/fatback/files/patch-const71
-rw-r--r--sysutils/fatback/files/patch-display125
-rw-r--r--sysutils/fatback/files/patch-trim42
-rw-r--r--sysutils/fatback/files/patch-warnings36
5 files changed, 279 insertions, 1 deletions
diff --git a/sysutils/fatback/Makefile b/sysutils/fatback/Makefile
index 5d4b2ee4d5b3..f8e148f344bb 100644
--- a/sysutils/fatback/Makefile
+++ b/sysutils/fatback/Makefile
@@ -6,7 +6,8 @@
#
PORTNAME= fatback
-DISTVERSION= 1.3
+PORTVERSION= 1.3
+PORTREVISION= 1
CATEGORIES= sysutils
MASTER_SITES= SF/${PORTNAME}/${PORTNAME}/${PORTNAME}-${PORTVERSION}
@@ -18,6 +19,9 @@ MAKE_JOBS_SAFE= yes
MAN1= fatback.1
INFO= fatback-manual
+EXTRACT_AFTER_ARGS+= |${TAR} -xpf - \
+ --exclude 'getopt*' \
+ --exclude 'set[yl].c'
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/${PORTNAME} ${PREFIX}/bin
diff --git a/sysutils/fatback/files/patch-const b/sysutils/fatback/files/patch-const
new file mode 100644
index 000000000000..828f9aca4d82
--- /dev/null
+++ b/sysutils/fatback/files/patch-const
@@ -0,0 +1,71 @@
+--- sety.y 2001-01-10 08:44:52.000000000 -0500
++++ sety.y 2010-04-14 13:36:15.000000000 -0400
+@@ -3,8 +3,9 @@
+ #include "vars.h"
+ #include "interface_data.h"
++static void yyerror(const char *);
+ %}
+
+ %union {
+- char *string;
++ const char *string;
+ }
+
+@@ -20,6 +21,7 @@
+ %%
+ #include <stdio.h>
+-void yyerror(char *s)
++void
++yyerror(const char *s)
+ {
+- printf("%s\n", s);
++ fprintf(stderr, "%s\n", s);
+ }
+--- vars.h 2001-01-25 03:22:24.000000000 -0500
++++ vars.h 2010-04-14 13:32:33.000000000 -0400
+@@ -25,6 +25,6 @@
+ } fbvar_t;
+
+-extern int set_fbvar(char *, ...);
+-extern fbvar_t *get_fbvar(char *);
++extern int set_fbvar(const char *, ...);
++extern fbvar_t *get_fbvar(const char *);
+
+ #endif /*VARS_H*/
+--- vars.c 2001-05-30 11:45:19.000000000 -0400
++++ vars.c 2010-04-14 13:33:19.000000000 -0400
+@@ -25,5 +25,6 @@
+ * Change a value of a variable in the vars[] array.
+ */
+-int set_fbvar(char *varname, ...)
++int
++set_fbvar(const char *varname, ...)
+ {
+ int i, found = 0;
+@@ -34,9 +35,9 @@
+ if (strcmp(vars[i].name, varname) == 0) {
+ unsigned int iarg;
+- char *sarg;
++ const char *sarg;
+ found++;
+ switch (vars[i].type) {
+ case FB_BOOL:
+- sarg = va_arg(arg_list, char *);
++ sarg = va_arg(arg_list, const char *);
+ if (strcmp(sarg, "on") == 0)
+ vars[i].val.bval = 1;
+@@ -49,5 +50,5 @@
+ break;
+ case FB_STRING:
+- sarg = va_arg(arg_list, char *);
++ sarg = va_arg(arg_list, const char *);
+ vars[i].val.sval = strdup(sarg);
+ break;
+@@ -63,5 +64,6 @@
+ * This currently returns a copy of the structure, this should be changed.
+ */
+-fbvar_t *get_fbvar(char *varname)
++fbvar_t *
++get_fbvar(const char *varname)
+ {
+ int i;
diff --git a/sysutils/fatback/files/patch-display b/sysutils/fatback/files/patch-display
new file mode 100644
index 000000000000..3c3c7a29326a
--- /dev/null
+++ b/sysutils/fatback/files/patch-display
@@ -0,0 +1,125 @@
+--- Makefile.in 2001-05-30 10:49:02.000000000 -0400
++++ Makefile.in 2010-04-09 22:15:58.000000000 -0400
+@@ -71,3 +71,3 @@
+
+-CFLAGS = -g -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
++CFLAGS += -Wformat -Werror
+ bin_PROGRAMS = fatback
+--- output.h 2001-05-30 11:47:04.000000000 -0400
++++ output.h 2010-04-09 21:41:03.000000000 -0400
+@@ -13,5 +13,9 @@
+
+ int audit_init(char *, char **);
+-int display(displaylevel_t, char *, ...);
++#ifndef __GNUC__
++# define __attribute__(x)
++#endif
++int display(displaylevel_t, const char *, ...)
++ __attribute__((format(printf, 2, 3)));
+ void ticmarker(void);
+ void audit_close(void);
+--- output.c 2001-05-30 11:47:04.000000000 -0400
++++ output.c 2010-04-09 21:41:57.000000000 -0400
+@@ -45,7 +45,8 @@
+ * Display arguments to the screen/audit log
+ */
+-int display(displaylevel_t level, char *format, ...)
++int
++display(displaylevel_t level, const char *format, ...)
+ {
+- va_list arg_list;
++ va_list arg_list, arg_copy;
+ fbvar_t *verbose_var;
+ unsigned verbose;
+@@ -54,6 +55,6 @@
+ /* get the verbosity level from the fatback symbol table */
+ if (!(verbose_var = get_fbvar("verbose"))) {
+- printf("Error reading variable\n");
+- return;
++ fprintf(stderr, "Error reading variable named `verbose'.\n");
++ return -1;
+ } else {
+ verbose = verbose_var->val.ival;
+@@ -63,9 +64,10 @@
+ /* print the rest of the arguments in standard printf style */
+ va_start(arg_list, format);
++ if ((level < VERBOSE) || (verbose && level == VERBOSE))
++ va_copy(arg_copy, arg_list);
+ retval = vfprintf(Audit_log, format, arg_list);
+ if ((level < VERBOSE) || (verbose && level == VERBOSE))
+- vfprintf(ostream, format, arg_list);
++ vfprintf(ostream, format, arg_copy);
+ va_end(arg_list);
+-
+ return retval;
+ }
+@@ -76,10 +78,10 @@
+ void ticmarker(void)
+ {
+- char *tics = "|/-\\|/-\\";
++ const char *tics = "|/-\\|/-\\";
+ const int numtics = 8;
+ static int currtic;
+
+ printf("\r%c", tics[currtic]);
+- currtic = ++currtic % numtics;
++ currtic = (currtic + 1) % numtics;
+ }
+
+--- interface.c 2001-05-30 11:47:03.000000000 -0400
++++ interface.c 2010-04-09 21:39:43.000000000 -0400
+@@ -69,5 +69,5 @@
+ display(NORMAL, "\n");
+ choice = readline(">");
+- display(LOGONLY, "%s\n");
++ display(LOGONLY, "\n");
+ part = atoi(choice);
+ free(choice);
+--- vbr.c 2001-05-30 11:47:04.000000000 -0400
++++ vbr.c 2010-04-09 20:42:55.000000000 -0400
+@@ -156,5 +156,6 @@
+ /* run the VBR through a quick sanity check */
+ if (!scheck_vbr(vbr, signature)) {
+- display(NORMAL, "No valid VBR found at offset %d\n", offset);
++ display(NORMAL, "No valid VBR found at offset %lld\n",
++ (long long)offset);
+ return NULL;
+ }
+@@ -281,5 +282,5 @@
+ display(VERBOSE, "total_sects_s: %u\n", vbr->total_sects_s);
+ display(VERBOSE, "media_descriptor: %x\n", vbr->media_descriptor);
+- display(VERBOSE, "sects_per_fat: %u\n", vbr->sects_per_fat);
++ display(VERBOSE, "sects_per_fat: %lu\n", vbr->sects_per_fat);
+ display(VERBOSE, "sects_per_track: %u\n", vbr->sects_per_track);
+ display(VERBOSE, "num_heads: %u\n", vbr->num_heads);
+--- fatback.c 2001-05-30 11:44:10.000000000 -0400
++++ fatback.c 2010-04-14 13:05:29.000000000 -0400
+@@ -238,5 +238,6 @@
+ }
+ myvbr->fat_entries = num_fat_entries;
+- display(VERBOSE, "Rood dir location: %lu\n", rdir_loc);
++ display(VERBOSE, "Rood dir location: %llu\n",
++ (unsigned long long)rdir_loc);
+ if (!clusts) {
+ display(VERBOSE, "Unable to read FAT in partition\n");
+--- dirtree.c 2001-05-30 11:47:03.000000000 -0400
++++ dirtree.c 2010-04-14 13:07:55.000000000 -0400
+@@ -158,5 +158,7 @@
+ * point can only be garbage. */
+ if (lastlogged_clust != clust) {
+- display(VERBOSE, "Unrecognized directory information in cluster at offset %lu\n", clust->loc);
++ display(VERBOSE, "Unrecognized directory "
++ "information in cluster at offset %llu\n",
++ (unsigned long long)clust->loc);
+ lastlogged_clust = clust;
+ }
+--- fat.c 2001-05-30 11:47:03.000000000 -0400
++++ fat.c 2010-04-14 13:09:06.000000000 -0400
+@@ -63,5 +63,6 @@
+ }
+ if (!(clust_array = (*read_fat)(entries, offset, fat_size))) {
+- display(NORMAL, "Unable to read fat filesystem at offset %l\n", offset);
++ display(NORMAL, "Unable to read fat filesystem at offset %lld\n",
++ (long long)offset);
+ return NULL;
+ }
diff --git a/sysutils/fatback/files/patch-trim b/sysutils/fatback/files/patch-trim
new file mode 100644
index 000000000000..b32b0030e7fa
--- /dev/null
+++ b/sysutils/fatback/files/patch-trim
@@ -0,0 +1,42 @@
+This file removes the getopt* and the outputs of Lex and Yacc
+bundled by the author in favor of
+
+ * getopt available from FreeBSD
+ * sources regenarated by modern flex and yacc on FreeBSD
+
+--- Makefile.in 2001-05-30 10:49:02.000000000 -0400
++++ Makefile.in 2010-04-14 13:20:45.000000000 -0400
+@@ -73,4 +73,4 @@
+ bin_PROGRAMS = fatback
+-fatback_SOURCES = fatback.c mbr.c vbr.c util.c sig.c output.c input.c recovery.c dirtree.c lfn.c fat.c interface.c interface_data.c vars.c cmd_chain.c cmd_cp.c cmd_sh.c cmd_misc.c cmd_ls.c cmd_stat.c cmd_lostchains.c cmd_set.c sety.y setl.l getopt.c getopt1.c cmd_cpchain.c fatback.h mbr.h vbr.h util.h sig.h output.h input.h dirtree.h recovery.h lfn.h fat.h interface.h interface_data.h vars.h getopt.h sety.h
++fatback_SOURCES = fatback.c mbr.c vbr.c util.c sig.c output.c input.c recovery.c dirtree.c lfn.c fat.c interface.c interface_data.c vars.c cmd_chain.c cmd_cp.c cmd_sh.c cmd_misc.c cmd_ls.c cmd_stat.c cmd_lostchains.c cmd_set.c sety.y setl.l cmd_cpchain.c fatback.h mbr.h vbr.h util.h sig.h output.h input.h dirtree.h recovery.h lfn.h fat.h interface.h interface_data.h vars.h
+
+ fatback_LDADD = @LEXLIB@
+@@ -95,5 +95,5 @@
+ recovery.o dirtree.o lfn.o fat.o interface.o interface_data.o vars.o \
+ cmd_chain.o cmd_cp.o cmd_sh.o cmd_misc.o cmd_ls.o cmd_stat.o \
+-cmd_lostchains.o cmd_set.o sety.o setl.o getopt.o getopt1.o \
++cmd_lostchains.o cmd_set.o sety.o setl.o \
+ cmd_cpchain.o
+ fatback_DEPENDENCIES =
+@@ -114,5 +114,5 @@
+ DIST_COMMON = README AUTHORS COPYING ChangeLog INSTALL Makefile.am \
+ Makefile.in NEWS aclocal.m4 configure configure.in install-sh missing \
+-mkinstalldirs setl.c sety.c texinfo.tex
++mkinstalldirs texinfo.tex
+
+
+@@ -439,5 +439,5 @@
+ cmd_chain.o: cmd_chain.c interface.h dirtree.h lfn.h fat.h vbr.h \
+ fatback.h mbr.h interface_data.h output.h
+-cmd_cp.o: cmd_cp.c getopt.h interface_data.h interface.h dirtree.h lfn.h \
++cmd_cp.o: cmd_cp.c interface_data.h interface.h dirtree.h lfn.h \
+ fat.h vbr.h fatback.h mbr.h recovery.h output.h
+ cmd_cpchain.o: cmd_cpchain.c interface.h dirtree.h lfn.h fat.h vbr.h \
+@@ -458,5 +458,5 @@
+ dirtree.h lfn.h vars.h
+ fat.o: fat.c vbr.h fatback.h mbr.h output.h util.h input.h fat.h
+-fatback.o: fatback.c getopt.h input.h output.h mbr.h util.h vbr.h \
++fatback.o: fatback.c input.h output.h mbr.h util.h vbr.h \
+ fatback.h fat.h dirtree.h lfn.h interface.h vars.h
+ getopt.o: getopt.c getopt.h
diff --git a/sysutils/fatback/files/patch-warnings b/sysutils/fatback/files/patch-warnings
new file mode 100644
index 000000000000..45c1059e11d9
--- /dev/null
+++ b/sysutils/fatback/files/patch-warnings
@@ -0,0 +1,36 @@
+--- recovery.c 2001-05-30 11:47:04.000000000 -0400
++++ recovery.c 2010-04-09 20:50:48.000000000 -0400
+@@ -69,6 +69,7 @@
+ display(VERBOSE, log_nametaken, filename, cluster, fname);
+
+- if ((file = open(fname, O_WRONLY|O_CREAT|O_EXCL, S_IRUSR|S_IRGRP|S_IROTH|S_IWUSR)) == NULL) {
+- perror("Error");
++ if ((file = open(fname, O_WRONLY|O_CREAT|O_EXCL,
++ S_IRUSR|S_IRGRP|S_IROTH|S_IWUSR)) < 0) {
++ perror(fname);
+ free(fname);
+ return -1;
+@@ -265,7 +266,5 @@
+ const size_t MAX_NUMBER_LEN = 100;
+ char *new_fname = fname;
+- struct stat stat_buf;
+ unsigned i;
+- int test;
+
+ assert(fname);
+--- cmd_cp.c 2001-05-30 11:40:00.000000000 -0400
++++ cmd_cp.c 2010-04-09 21:40:15.000000000 -0400
+@@ -6,4 +6,5 @@
+ #include <stdio.h>
+ #include <stdlib.h>
++#include <string.h>
+ #include <unistd.h>
+ #include <limits.h>
+--- cmd_ls.c 2001-05-30 11:42:01.000000000 -0400
++++ cmd_ls.c 2010-04-09 21:42:15.000000000 -0400
+@@ -6,4 +6,5 @@
+ #include <stdio.h>
+ #include <stdlib.h>
++#include <string.h>
+ #include <assert.h>
+ #include <time.h>