summaryrefslogtreecommitdiff
path: root/src/pch.h
Commit message (Collapse)AuthorAgeFilesLines
* Fail when out of memory in set_hunkmax()v2.7.2Andreas Gruenbacher2015-01-201-1/+0
| | | | | | | | src/pch.c (another_hunk): Call set_hunkmax() from here to make sure it is called even when falling back from plan A to plan B. (open_patch_file): No need to call set_hunkmax() anymore. src/pch.c (set_hunkmax): Fail when out of memory. Make static. src/pch.h: Remove set_hunkmax() prototype.
* Move symlink_target_is_valid() and cwd_is_root()Andreas Gruenbacher2015-01-201-1/+0
| | | | | * src/util.c: Move symlink_target_is_valid() and cwd_is_root() here from src/pch.c.
* Make sure symlinks don't point outside working directory (CVE-2015-119)Andreas Gruenbacher2015-01-191-0/+1
| | | | | | | | | | | When creating symlinks from git-style patches, make sure the symlinks don't point above the current working directory. Otherwise, a subsequent patch could use the symlink to write outside the working directory. * src/pch.c (symlink_target_is_valid): New function to check for valid symlink targets. * src/util.c (move_file): Use symlink_target_is_valid() here. * tests/symlinks: Add valid and invalid symlink test cases.
* Change the type of *_needs_removal from int to boolAndreas Gruenbacher2012-09-131-1/+1
|
* Accessor functions for SHA1 hashes in git-style diffsAndreas Gruenbacher2012-07-311-0/+1
| | | | | | | | | | | * src/pch.c (p_sha1): New variable. (get_sha1): New function for saving a sha1 checksum. (sha1_says_nonexistent): Take a NULL terminated string instead of an end pointer. (intuit_diff_type): Remember the SHA1 hashes from index headers in git-style diffs in p_sha1. (pch_sha1): New function for accessing p_sha1. * src/pch.h (pch_sha1): Declare.
* Export the patch typeAndreas Gruenbacher2012-04-171-0/+1
| | | | | | * src/pch.c (p_git_diff): New global variable. (intuit_diff_type): Use p_git_diff instead of a local variable. (pch_git_diff): New function.
* maint: update all copyright year number rangesJim Meyering2012-01-011-1/+1
| | | | Run "make update-copyright".
* build: update to latest gnulib and adaptJim Meyering2011-12-141-18/+18
| | | | | | | | | | | | | | | Mark functions as pure of const, per recommendations enabled by new gcc -W options. Apply _GL_ATTRIBUTE_PURE and _GL_ATTRIBUTE_CONST. * src/common.h: Apply new function attributes. * src/pch.c: Likewise. * src/pch.h: Likewise. * src/util.c: Likewise. * src/util.h: Likewise. * configure.ac: Use -Wno-format-nonliteral. * m4/.gitignore: Update. * gnulib: Update to latest. * cfg.mk: Exempt src/util.c from two tests, to avoid new "make syntax-check" failures.
* maint: update copyright date year ranges to include 2011Jim Meyering2011-03-271-2/+1
| | | | | * bootstrap.conf (gnulib_modules): Add update-copyright. Run "make update-copyright".
* build: avoid three gcc warningsJim Meyering2011-03-271-1/+1
| | | | | | * src/patch.c (mangled_patch): Add "noreturn" attribute. * src/pch.h (pch_timestamp): Remove ignored "const" attribute. * src/version.c (XTERN): Remove unused #undef and #define.
* do_ed_script(): Pass in the filenames to useAndreas Gruenbacher2010-09-171-1/+1
| | | | | | | * src/pch.c (do_ed_script): Add inname, outname, and outname_needs_removal arguments. This isolates TMPOUTNAME and TMPOUTNAME_needs_removal to patch.c. * src/patch.c (main): Update do_ed_script() call.
* git diffs: Parse copy and rename headersAndreas Gruenbacher2010-05-021-0/+2
| | | | | | | | | | * src/pch.c (p_copy, p_rename): New variables. (pch_copy, pch_rename): New functions. (intuit_diff_type): Parse the "copy from", "copy to", "rename from", and "rename to" headers. * src/util.c (fetchname): Return the fetched name per reference (after freeing the previous name if any). Also free the previous timestamp string if any.
* Pass up the file type and check for consistent typesAndreas Gruenbacher2010-05-021-1/+1
| | | | | | * src/pch.c (intuit_diff_type, there_is_another_patch): Pass up the file type. * src/patch.c (main): Check for consistent file types.
* git diffs: Parse file modesAndreas Gruenbacher2010-05-021-0/+1
| | | | | | | | * src/pch.c (p_mode): New variable. (fetchmode, pch_mode): New functions. (intuit_diff_type): Recognize git diffs which contain no hunks. Parse and store the file modes in the "index", "old mode", "new mode", "deleted file mode", and "new file mode" headers.
* Use struct timespec instead of time_t internallyAndreas Gruenbacher2010-04-221-1/+11
| | | | | | | | | | | | | | * src/pch.h (pch_timestamp): Return timestamp as struct timespec instead of time_t. * src/pch.c: Use struct timespec instead of time_t. A tv_sec value of -1 indicates "no timestamp". * src/util.h (fetchname): Return timestamp as struct timespec instead of time_t. * src/util.c (fetchname): str2time() does not give us nanoseconds; set them to zero for now. * src/patch.c (main): Only use the seconds in timestamps for now. * bootstrap.conf: Add the time module for getting struct timespec declared on old hosts.
* Globally rename type LINENUM to lin (as in diffutils)Andreas Gruenbacher2010-04-191-12/+12
| | | | * Globally rename type LINENUM to lin (as in diffutils).
* * src/bestmatch.h, src/common.h, src/diffseq.h, src/inp.c, src/inp.h,Andreas Gruenbacher2010-01-021-7/+5
| | | | | | | | src/maketime.c, src/maketime.h, src/merge.c, src/partime.c, src/partime.h, src/patch.c, src/pch.c, src/pch.h, src/quotesys.c, src/util.c, src/util.h, src/version.c: Add year 2010 to copyright notice. Replace the GPLv2 license template with the GPLv3 license template.
* Preserve timestamps in reject filesAndreas Gruenbacher2009-04-071-0/+1
|
* Copyright notice updatesAndreas Gruenbacher2009-04-051-1/+1
|
* Move all source and header files into src/Andreas Gruenbacher2009-04-051-0/+48