summaryrefslogtreecommitdiff
path: root/attach.c
AgeCommit message (Collapse)Author
2025-06-20Clean up whitespace, mixed spaces/tabs, and brace styleHEADmasterNed T. Crigler
2025-06-19Always check the return value of the write() system callNed T. Crigler
dtach was assuming that writes with a small byte count could never fail, and was not handling partial writes for larger byte counts in a few places. This should also suppress unused result warnings from gcc on systems that define _FORTIFY_SOURCE by default.
2025-06-19Check the return value of the fchdir() system callNed T. Crigler
dtach was not checking if the fchdir back to the old directory worked when it tried to get around the sun_path length limit.
2025-06-17Suppress unused parameter 'sig' warning from gccNed T. Crigler
gcc now warns that sig is an unused parameter: attach.c: In function 'win_change': attach.c:99:16: warning: unused parameter 'sig' [-Wunused-parameter] 99 | win_change(int sig) | ~~~~^~~
2024-12-09fix gcc-15 buildRudi Heitbaum
2017-03-05Update license header in source files.Ned T. Crigler
Use http://www.gnu.org/licenses/ instead of a postal address as suggested in PR #7.
2016-05-08Update copyrights for 2016.Ned T. Crigler
2015-07-18Update copyrights for 2015.Ned T. Crigler
2015-07-18Add dtach -p.Ned T. Crigler
dtach -p copies the contents of standard input to a session. Based on an initial patch by @johnlane.
2014-08-04Try to use chdir to get around the sun_path length limit.Ned T. Crigler
If a socket's path name would overflow sun_path, try to make it fit by temporarily changing to the directory the socket is in and using the path's basename in sun_path. This should help for the case where the basename of the socket does fit in sun_path, even if the rest of the path doesn't.
2014-08-04Prevent buffer overflow with a long socket path name.Ned T. Crigler
The code wasn't checking for overflow before copying the socket path name to to the sun_path field, which is usually much smaller than PATH_MAX. Report and initial patch by Paul Wilkinson.
2014-08-04Silence valgrind memcheck error by memset()-ing pkt to 0Paul Wilkinson
valgrind reports: Syscall param write(buf) points to uninitialised byte(s) In this case, it is a false positive, but adding this single memset at attach start-up means the program is now clean when run with "valgrind --trace-children=yes dtach -c ...", which can make future debugging easier.
2012-07-01Fix error handling for read from stdin in attach.cNed T. Crigler
attach.c did not correctly handle a read from stdin when read returned an error. The code assigned the return value of read to pkt.len (an unsigned char) before checking the value. This prevented the error check from working correctly, since an unsigned integer can never be < 0. A packet with an invalid length was then sent to the master, which then sent 255 bytes of garbage to the program. Fix the bug in attach.c and the unchecked packet length bug in master.c. Report and initial patch by Enrico Scholz.
2012-07-01Use ssize_t for the return type of read/write instead of int.Ned T. Crigler
2008-01-29Update copyrights for 2008.Ned T. Crigler
2006-09-27Try to detect and remove stale sockets when dtach -A is used. BeNed T. Crigler
paranoid about this, and only remove the specified file if connect says the connection was refused and stat says the file is a socket. Also dtach -A now only tries to create the socket if the connection was refused or the socket did not exist, instead of on any random error as before.
2006-06-03Print an error message if we could not execute the desired command, instead ofNed T. Crigler
exiting silently. Also make sure the master process waits until the client attaches when using the -A and -c modes, so that the error message has a chance of being seen.
2004-08-25Changed restore_term to remove the Linux-specific escape sequence to restoreNed T. Crigler
the cursor size, which is handled incorrectly by some terminal emulators.
2004-07-01Add an extra signal call to the win_change function to make sure the SIGWINCHNed T. Crigler
handler isn't reset on certain systems.
2004-06-24Allow the redraw method to be chosen by the user, and include the old Ctrl LNed T. Crigler
character method again.
2004-06-22Changed the attach code to be paranoid about checking the return value ofNed T. Crigler
select when checking the file descriptors for activity.
2004-05-26dtach 0.6Ned T. Crigler
2001-11-28Fix fd leakage.Ned T. Crigler
Prevent atexit from being called twice on dtach -A.
2001-11-05Portability updates thanks to sourceforge's compile farm. dtach should nowNed T. Crigler
work on: FreeBSD, Debian/alpha, Debian/sparc, Debian/PPC, and Solaris. Bump version.
2001-09-28initial import to sourceforgeNed T. Crigler