Commit ef6284dd authored by Bernhard Link's avatar Bernhard Link

add mode to rredtool to create .diff/ directories

parent a3f628c5
......@@ -23,7 +23,7 @@ EXTRA_reprepro_SOURCE = $(ARCHIVE_UNUSED)
changestool_SOURCES = uncompression.c sourceextraction.c readtextfile.c filecntl.c tool.c chunkedit.c strlist.c checksums.c sha1.c sha256.c md5.c mprintf.c chunks.c signature.c dirs.c names.c $(ARCHIVE_USED)
rredtool_SOURCES = rredtool.c rredpatch.c
rredtool_SOURCES = rredtool.c rredpatch.c mprintf.c filecntl.c sha1.c
noinst_HEADERS = archallflood.h needbuild.h globmatch.h printlistformat.h pool.h atoms.h uncompression.h remoterepository.h copypackages.h sourceextraction.h checksums.h readtextfile.h filecntl.h sha1.h sha256.h configparser.h database_p.h database.h freespace.h log.h changes.h incoming.h guesscomponent.h md5.h dirs.h files.h chunks.h reference.h binaries.h sources.h checks.h names.h release.h error.h mprintf.h updates.h strlist.h signature.h signature_p.h distribution.h debfile.h checkindeb.h checkindsc.h upgradelist.h target.h aptmethod.h downloadcache.h override.h terms.h termdecide.h ignore.h filterlist.h dpkgversions.h checkin.h exports.h globals.h tracking.h trackingt.h optionsfile.h readrelease.h donefile.h pull.h ar.h filelist.h contents.h chunkedit.h uploaderslist.h indexfile.h rredpatch.h diffindex.h
......
......@@ -17,9 +17,12 @@ AC_SYS_LARGEFILE
AC_C_BIGENDIAN()
AC_HEADER_STDBOOL
AC_CHECK_FUNCS([closefrom])
AC_CHECK_FUNCS([strndup])
AC_CHECK_FUNCS([dprintf])
AC_CHECK_FUNCS([closefrom strndup dprintf])
found_mktemp=no
AC_CHECK_FUNCS([mkostemp mkstemp],[found_mktemp=yes ; break],)
if test "$found_mktemp" = "no" ; then
AC_MSG_ERROR([Missing mkstemp or mkostemp])
fi
AC_CHECK_FUNC([vasprintf],,[AC_MSG_ERROR([Could not find vasprintf implementation!])])
DBLIBS=""
......
......@@ -92,6 +92,20 @@ void patch_free(/*@only@*/struct rred_patch *p) {
}
retvalue patch_load(const char *filename, off_t length, struct rred_patch **patch_p) {
int fd;
fd = open(filename, O_NOCTTY|O_RDONLY);
if( fd < 0 ) {
int err = errno;
fprintf(stderr,
"Error %d opening '%s' for reading: %s\n", err, filename, strerror(err));
return RET_ERRNO(err);
}
return patch_loadfd(filename, fd, length, patch_p);
}
retvalue patch_loadfd(const char *filename, int fd, off_t length, struct rred_patch **patch_p) {
int i;
struct rred_patch *patch;
const char *p, *e, *d, *l;
......@@ -101,16 +115,11 @@ retvalue patch_load(const char *filename, off_t length, struct rred_patch **patc
struct stat statbuf;
patch = calloc(1, sizeof(struct rred_patch));
if( FAILEDTOALLOC(patch) )
if( FAILEDTOALLOC(patch) ) {
(void)close(fd);
return RET_ERROR_OOM;
patch->fd = open(filename, O_NOCTTY|O_RDONLY);
if( patch->fd < 0 ) {
int err = errno;
fprintf(stderr,
"Error %d opening '%s' for reading: %s\n", err, filename, strerror(err));
patch_free(patch);
return RET_ERRNO(err);
}
patch->fd = fd;
i = fstat(patch->fd, &statbuf);
if( i != 0 ) {
int err = errno;
......
......@@ -5,6 +5,7 @@ struct rred_patch;
struct modification;
retvalue patch_load(const char *, off_t, /*@out@*/struct rred_patch **);
retvalue patch_loadfd(const char *, int, off_t, /*@out@*/struct rred_patch **);
void patch_free(/*@only@*/struct rred_patch *);
/*@only@*//*@null@*/struct modification *patch_getmodifications(struct rred_patch *);
/*@null@*/const struct modification *patch_getconstmodifications(struct rred_patch *);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment