aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/env_universal_common.cpp
Commit message (Collapse)AuthorAge
* Make IWYU output in lint.cpp less messyGravatar Aaron Gyes2016-06-23
| | | | And re-run IWYU, adjust #includes.
* Fix env_universal_common.cpp filesize comparisons.Gravatar Aaron Gyes2016-06-12
| | | | | | | | * if (result == ULLONG_MAX) is always false, likely a typo as result is unsigned long, and the comment says ULONG_MAX. * use off_t instead of size_t for file size where it can mismatch st_size's type in stat.h
* fix random lint issuesGravatar Kurtis Rader2016-05-29
| | | | | | | | This only eliminates errors reported by `make lint`. It shouldn't cause any functional changes. This change does remove several functions that are unused. It also removes the `desc_arr` variable which is both unused and out of date with reality.
* lint cleanup: eliminate "redundant" errorsGravatar Kurtis Rader2016-05-04
| | | | | This removes some pointless parentheses but the primary focus is removing redundancies like unnecessary "else" clauses.
* restyle env_universal module to match project styleGravatar Kurtis Rader2016-04-28
| | | | | | Reduces lint errors from 121 to 52 (-57%). Line count from 1916 to 1671 (-13%). Another step in resolving issue #2902.
* env_universal_common.cpp: pass correct flag to fcntlGravatar David Adam2016-04-27
| | | | | | Closes #2955. (cherry picked from commit d5797c543982a0fbc8201ae21db5009e9447f75d)
* add better support for IWYU and fix thingsGravatar Kurtis Rader2016-04-26
| | | | | | | | | Remove the "make iwyu" build target. Move the functionality into the recently introduced lint.fish script. Fix a lot, but not all, of the include-what-you-use errors. Specifically, it fixes all of the IWYU errors on my OS X server but only removes some of them on my Ubuntu 14.04 server. Fixes #2957
* Remove a dead function bool_from_env_varGravatar ridiculousfish2016-04-07
|
* fixes for cppcheck lint warningsGravatar Kurtis Rader2016-04-04
| | | | | | Refine the linting behavior. Fix several of the, mostly trivial, lint errors.
* convert atypical env_universal_common loggingGravatar Kurtis Rader2016-04-03
| | | | | | | | | | This is a quick and dirty conversion of the atypical, and undocumented, logging done by env_universal_common.cpp to the usual `debug()` pattern. I didn't want to drop the messages because they could be useful when debugging future issues. So I simply converted them to the lowest debug level using the normal debug() function. Fixes #2887
* env_universal_common: use uid_t in geteuid checksGravatar David Adam2016-03-18
| | | | | | | | | The u_int typedef fails to compile on all platforms (e.g. Windows). It is part of the code imported from tmux. Update it to the SUS-standard uid_t. Closes #2821.
* Improve error handling around fchownGravatar Jeff Kowalski2016-03-12
| | | | | | | | | Address the feedback from the prior commit: - Change the sense of return value testing to match more common comparison idiom - Test result of fchmod as well as fchown - Change sense of return value testing around wrename as well - Include errno where possible in error message
* Handle return values from fchownGravatar Jeff Kowalski2016-03-12
| | | | | | | | | | | The function fchown is annotated with warn_unused_result. As formerly used in the code, it would emit a compiler warning ```warning: ignoring return value of ‘fchown’, declared with attribute warn_unused_result [-Wunused-result]``` This commit notes the return value and emits appropriate error/logging messages if the call fails, creating more traceable results and satisfying the compiler.
* Tweak UTF8 decoding interfaceGravatar ridiculousfish2016-03-02
| | | | | | | | Previously, when decoding UTF-8, we would first run through the array to compute the correct size, then allocate a buffer of that size, then run through the array again to fill the buffer, and then copy it into a std::wstring. With this fix we can copy it into the string directly, reducing allocations and only requiring a single pass.
* Mark a bunch of constructors as explicitGravatar ridiculousfish2016-02-27
| | | | This prevents undesired implicit conversions
* Miscellaneous cleanup and dead code removalGravatar ridiculousfish2016-02-19
| | | | Noticed by cppcheck
* Check that $XDG_RUNTIME_DIR is valid and accessibleGravatar Tanner Bruce2015-12-11
| | | | Signed-off-by: David Adam <zanchey@ucc.gu.uwa.edu.au>
* env_universal_common.cpp: don't bother trying nonexistent pathGravatar David Adam2015-11-28
|
* Attempt to fix the sporadic uvar test failures on LinuxGravatar ridiculousfish2015-11-08
| | | | | | | | | | | | | | | | | | We identify when the universal variable file has changed out from under us by comparing a bunch of fields from its stat: inode, device, size, high-precision timestamp, generation. Linux aggressively reuses inodes, and the size may be the same by coincidence (which is the case in the tests). Also, Linux officially has nanosecond precision, but in practice it seems to only uses millisecond precision for storing mtimes. Thus if there are three or more updates within a millisecond, every field we check may be the same, and we are vulnerable to the ABA problem. I believe this explains the occasional test failures. The solution is to manually set the nanosecond field of the mtime timestamp to something unlikely to be duplicated, like a random number, or better yet, the current time (with nanosecond precision). This is more in the spirit of the timestamp, and it means we're around a million times less likely to collide. This seems to fix the tests.
* Maintain ownership when rewriting universal variables fileGravatar ridiculousfish2015-09-26
| | | | Fixes #2176
* env_universal_common: always pick shmem strategy on CygwinGravatar David Adam2015-08-24
| | | | | | | | Cygwin FIFOs do not support more than one reader, so avoid them on this platform. An autoconf feature test would be helpful but is tricky to write. Closes #2152.
* Merge branch 'master' into iwyuGravatar David Adam2015-07-26
|
* Migrate source files into src/ directoryGravatar ridiculousfish2015-07-24
This change moves source files into a src/ directory, and puts object files into an obj/ directory. The Makefile and xcode project are updated accordingly. Fixes #1866