Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | When system calls indicate an error they return -1, not some arbitrary | 2019-06-28 | 1 | -3/+3 | |
| | | | | | | value < 0. errno is only updated in this case. Change all (most?) callers of syscalls to follow this better, and let's see if this strictness helps us in the future. | ||||
* | Cleanup: | 2019-05-15 | 1 | -40/+2 | |
| | | | | | | | | | | | | | | | Delete handling of LC_COLLATE (which has no effect) and delete support for non-ASCII single-byte encodings, allowing to replace the condition byte_sort == 1 with sort_mb_cur_max == 1. Since none of our single-byte character and string functions are locale dependent, also zap inspection of LC_CTYPE while here. For know, keep the code supporting multi-byte encodings even though it is very ugly, it cannot be reached right now, and we have no plans to enable it any time soon. OK millert@ tb@ | ||||
* | Delete tentacles of LC_NUMERIC support. | 2019-05-13 | 1 | -57/+2 | |
| | | | | | | Our libc doesn't support that now and won't in the future. Minus ~90 lines of code, no functional change. OK tb@ | ||||
* | Fix a crash when "sort -m" is given no files. From Julien Ramseier. | 2017-01-04 | 1 | -2/+5 | |
| | |||||
* | make several program to use "chown" promise. | 2016-07-14 | 1 | -3/+3 | |
| | | | | | | | | | | | | | | | | it allows chown(2) call to change the user or group on a file. - usr.bin/compress : aka gzip - usr.bin/mg : open a file for writing - usr.bin/sed : inplace editing - usr.bin/sort : if outfile equals one of the input files ok deraadt@ tb@ (and a reminder from Remi Locherer) warning: in order to use it, you must have a recent kernel with the new promise. | ||||
* | The default modifier should be copied for empty keys even if -b is | 2015-10-24 | 1 | -5/+6 | |
| | | | | specified. From Cedric Krier. | ||||
* | Do not warn for sort -o if we can't chown the output temporary file | 2015-10-18 | 1 | -6/+4 | |
| | | | | to match the owner of the output file. | ||||
* | Pledge; OK millert@ tobias@ | 2015-10-17 | 1 | -33/+70 | |
| | |||||
* | Copy permissions AND ownership when -o will override an input file. | 2015-10-14 | 1 | -4/+8 | |
| | | | | with input by and ok deraadt@, millert@, tim@ | ||||
* | Ignore the setuid/setgid/sticky bits when copying the permissions of an input | 2015-10-13 | 1 | -2/+2 | |
| | | | | | | file to the new output file. In preparation for pledge(2). Suggested by and OK millert@ | ||||
* | -C and -c allow at most one input file. Ensure this is the case when the | 2015-10-13 | 1 | -6/+6 | |
| | | | | | | input files are specified through --files0-from. OK millert@ | ||||
* | The -b flag should only apply when key fields are specified. | 2015-04-05 | 1 | -9/+15 | |
| | | | | If -b follows -k it has no effect. | ||||
* | Do not permute command line arguments but still support the | 2015-04-05 | 1 | -5/+15 | |
| | | | | obsolescent "-o outfile" after input files syntax. | ||||
* | Only one input file is allowed with the -c/-C flags. | 2015-04-03 | 1 | -1/+5 | |
| | |||||
* | The combination of -c and -o is not specified by POSIX. In fact, the call | 2015-04-03 | 1 | -8/+8 | |
| | | | | | | | | | | | | | "sort -o file -c file" has unspecified behavior and would leave an empty file behind if it was sorted, the original file it was not. If -c (or -C) has been specified, only perform that action and ignore -o among other arguments. While at it, clean up check() internals. with input by and ok millert@ | ||||
* | If -S has been supplied multiple times, only take last one into account. | 2015-04-03 | 1 | -4/+7 | |
| | | | | | | Without this patch, multiple -S arguments influence each other. spotted by and ok millert@ | ||||
* | Prevent integer overflow when parsing -S argument as percentage. | 2015-04-02 | 1 | -1/+7 | |
| | | | | | | | Also make sure that the parsed memory amount, stored in a long long, won't be larger than SIZE_MAX to properly support 32 bit systems. with input by and ok millert@ | ||||
* | Global variable free_memory is only used in sort.c's set_hw_params, | 2015-04-02 | 1 | -2/+5 | |
| | | | | | | so turn it into a local one. ok millert@ | ||||
* | Fixed whitespace issues. | 2015-04-02 | 1 | -2/+2 | |
| | | | | ok millert@ | ||||
* | No need to strdup environment variable or command line arguments here. | 2015-04-02 | 1 | -5/+5 | |
| | | | | ok millert@ | ||||
* | Add signal name instead of array index (which is not the signal number) | 2015-04-02 | 1 | -2/+2 | |
| | | | | | | to sigaction error message. with input by and ok millert@ | ||||
* | Don't install signal handlers for SIGQUIT, SIGVTALRM, SIGPROF. | 2015-04-02 | 1 | -3/+3 | |
| | |||||
* | Check for overflow when handling buffer size suffixes. | 2015-04-01 | 1 | -2/+20 | |
| | |||||
* | Just use sort_reallocarray() everywhere. | 2015-04-01 | 1 | -2/+2 | |
| | |||||
* | Remove some unneeded NULL checks that don't really help anything. | 2015-04-01 | 1 | -130/+111 | |
| | | | | | It is better to crash when given bad input rather than producing a wrong result. None of the checks can actually be triggered. | ||||
* | Use exit value 2 for mutually exclusive option errors. | 2015-04-01 | 1 | -5/+11 | |
| | |||||
* | Fix typo in revision 1.55 | 2015-04-01 | 1 | -2/+2 | |
| | |||||
* | Fix last instance of malloc(n * sizeof(char)) idiom. | 2015-04-01 | 1 | -2/+2 | |
| | |||||
* | The argument to --sort is not optional so no need to check for NULL optarg. | 2015-04-01 | 1 | -15/+13 | |
| | |||||
* | No need for if (x) free(x) style checks, this is not K&R. | 2015-04-01 | 1 | -9/+5 | |
| | |||||
* | No need for an else clause after a continue, it just makes the | 2015-04-01 | 1 | -39/+33 | |
| | | | | code harder to read. | ||||
* | Style nits, remove whitespace at the start of a function. | 2015-04-01 | 1 | -9/+1 | |
| | |||||
* | If strtoul() fails to parse the argument to -k, just pass the | 2015-04-01 | 1 | -9/+9 | |
| | | | | | error back to the caller instead of calling err() directly. The user gets a more useful error message this way. | ||||
* | Use memcpy() not strncpy() when dynamically allocating and copying | 2015-04-01 | 1 | -12/+12 | |
| | | | | a substring. | ||||
* | Pass size of sopts buffer in to parse_pos_obs() for a length check and | 2015-04-01 | 1 | -8/+13 | |
| | | | | use size_t not int for column and field vars. | ||||
* | Better range checking for "sort -S" memory size. | 2015-04-01 | 1 | -43/+39 | |
| | |||||
* | Use strtonum() to parse argument to --batch-size and document the | 2015-04-01 | 1 | -8/+9 | |
| | | | | minimum value in the manual. | ||||
* | Ignore TMPDIR environment variable if setuid or setgid. | 2015-03-31 | 1 | -5/+7 | |
| | |||||
* | There's no good reason to make -m and -c mutually exclusive. | 2015-03-31 | 1 | -4/+1 | |
| | | | | Other sorts don't care and our regress uses this. | ||||
* | Add missing call to atexit() to clean up temp files on error. | 2015-03-31 | 1 | -18/+21 | |
| | | | | | | | | Use mkstemp() to create the temp file when "sort -o" specifies the same name as an input file and preserve the original file mode on the temp file. Check for write access on the original file before creating the temporary. Based on a diff from and OK bluhm@ | ||||
* | Use _exit() from signal handler so we don't call atexit handlers or | 2015-03-30 | 1 | -2/+2 | |
| | | | | flush stdio. | ||||
* | Do not install signal handlers for SIGABRT, SIGBUS or SIGSEGV. Also | 2015-03-30 | 1 | -41/+13 | |
| | | | | | install signal handlers for SIGPIPE, SIGXCPU, SIGXFSZ, SIGVTALRM, and SIGPROF to match the old sort. | ||||
* | Use the hw.usermem sysctl to determine the amount user (non-kernel) | 2015-03-20 | 1 | -16/+27 | |
| | | | | | | memory instead of sysconf(_SC_PHYS_PAGES) (which also counts pages wired by the kernel). Don't try to use a memory buffer larger than the datasize hard resource limit. Adapted from a diff by Andre Smagin. | ||||
* | Remove custom getdelim(3) and fix a small memory leak. From Andre Smagin. | 2015-03-20 | 1 | -25/+29 | |
| | |||||
* | update the note in STANDARDS about which options are extensions; also add -m | 2015-03-19 | 1 | -2/+2 | |
| | | | | to SYNOPSIS and usage(), which i missed in previous; | ||||
* | first run through this page. mainly getting SYNOPSIS and usage() orderly | 2015-03-19 | 1 | -3/+3 | |
| | | | | (if perhaps not quite correct yet); | ||||
* | Initial import of FreeBSD sort. | 2015-03-17 | 1 | -261/+1106 | |
| | |||||
* | Add parentheses to suppress compiler warning. | 2014-10-26 | 1 | -3/+3 | |
| | | | | | | sort.c:295:35: warning: '&&' within '||' [-Wlogical-op-parentheses] ok guenther@ | ||||
* | Userland reallocarray() audit. | 2014-10-11 | 1 | -3/+3 | |
| | | | | | | | Avoid potential integer overflow in the size argument of malloc() and realloc() by using reallocarray() to avoid unchecked multiplication. ok deraadt@ | ||||
* | repair buffer resizing "undershoot", and some minor issues with | 2013-11-13 | 1 | -3/+4 | |
| | | | | | math on void * assistance from guenther, ok millert |