summaryrefslogtreecommitdiffstats
path: root/fish/rc.c
Commit message (Collapse)AuthorAgeFilesLines
* Remove "convenience header" "gettext.h" and use <libintl.h> instead.Richard W.M. Jones2012-05-011-0/+1
| | | | | | | | | | | | gettextize provides a local file called "gettext.h". Remove this and use <libintl.h> from glibc headers instead. Most of this change is mechanical: #include <libintl.h> in every C file which uses any gettext function. But also we remove the gettext.h file, and adjust the "_" macros. Note that this effectively removes the ./configure --disable-nls option, although we don't know if that ever worked.
* Use O_CLOEXEC / SOCK_CLOEXEC for almost all file descriptors.Richard W.M. Jones2012-03-141-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | The presumption is that all file descriptors should be created with the close-on-exec flag set. The only exception are file descriptors that we want passed through to exec'd subprocesses (mainly pipes and stdin/stdout/stderr). For open calls, we pass O_CLOEXEC as an extra flag, eg: fd = open ("foo", O_RDONLY|O_CLOEXEC); This is a Linux-ism, but using a macro we can easily make it portable. For sockets, similarly: sock = socket (..., SOCK_STREAM|SOCK_CLOEXEC, ...); For accepted sockets, we use the Linux accept4 system call which allows flags to be supplied, but we use the Gnulib 'accept4' module to make this portable. For dup, dup2, we use the Linux dup3 system call, and the Gnulib modules 'dup3' and 'cloexec'.
* Replace 'int' with 'size_t' passim.Richard W.M. Jones2012-03-131-1/+2
| | | | | Analyze all uses of 'int' in the code, and replace with 'size_t' where appropriate.
* fish: remote: Output from close event now passed over stdout (RHBZ#802389).Richard W.M. Jones2012-03-121-0/+9
|
* fish: remote: Make sure global cleanups are called for guestfish --listen.Richard W.M. Jones2012-03-121-1/+2
| | | | | Return to the main program ('fish.c') and perform global cleanups when the guestfish remote server exits.
* fish: remote: Move close_stdout just before accept() call.Richard W.M. Jones2012-03-121-6/+6
| | | | This is just code motion.
* Update FSF address.Matthew Booth2011-11-081-1/+1
|
* Coverity: Initialize msg buffer.Richard W.M. Jones2011-08-231-0/+2
| | | | | msg_flags was not being initialized and would have been passed to sendmsg with a random value.
* fish: Make exit_on_error into a completely local variable.Richard W.M. Jones2011-01-181-1/+1
| | | | | | Note that 'time' and 'glob' (which both run subcommands) do not correctly pass the exit_on_error flag in the remote case. This is not a regression: the current code doesn't work either.
* fish: Add --listen --csh to for csh, tcsh compatibility.Richard W.M. Jones2010-11-051-1/+6
| | | | (Thanks Eric Blake).
* fish: More portable export sh statment.Richard W.M. Jones2010-11-051-1/+1
| | | | | | | Don't depend on bash, but allow sh/dash/etc format: GUESTFISH_PID=nn; export GUESTFISH_PID (Thanks Eric Blake).
* fish: Change 'int argc' to 'size_t argc' throughout.Richard W.M. Jones2010-10-211-3/+4
|
* maint: use EXIT_SUCCESS and EXIT_FAILURE, not 0 and 1 to exitJim Meyering2009-11-201-11/+11
| | | | | | | | | | | | | | | Convert all uses automatically, via these two commands: git grep -l '\<exit *(1)' \ | grep -vEf .x-sc_prohibit_magic_number_exit \ | xargs --no-run-if-empty \ perl -pi -e 's/\b(exit ?)\(1\)/$1(EXIT_FAILURE)/' git grep -l '\<exit *(0)' \ | grep -vEf .x-sc_prohibit_magic_number_exit \ | xargs --no-run-if-empty \ perl -pi -e 's/\b(exit ?)\(0\)/$1(EXIT_SUCCESS)/' * .x-sc_prohibit_magic_number_exit: New file. Edit (RWMJ): Don't change Java code.
* use STREQ, not strcmp: part 2Jim Meyering2009-11-091-1/+1
| | | | | git grep -l 'strcmp *([^=]*!= *0'|xargs \ perl -pi -e 's/\bstrcmp( *\(.*?\)) *!= *0\b/STRNEQ$1/g'
* Fix type punning warning about use of CMSG_DATA in Rawhide.Richard Jones2009-09-141-2/+4
|
* guestfish: Redirect stdout when executing remote commandsMatthew Booth2009-09-141-8/+126
| | | | | | | | | | | guestfish --listen necessarily redirects its stdout to /dev/null so as not to interfere with eval. The remote protocol doesn't contain any other provision for collecting stdout for the caller, so executing guestfish --remote will never generate any output. This patch fixes that by forwarding the caller's STDOUT to the listener over the unix socket connection. The listener redirects its STDOUT to the caller's STDOUT for the duration of the command, then closes it again.
* fish.c: avoid warningsJim Meyering2009-08-211-2/+0
| | | | | * fish/rc.c (UNIX_PATH_MAX): Remove unused definition. * fish/fish.h (rc_listen): Declare with __attribute__((noreturn)).
* fish: don't read freed memoryJim Meyering2009-08-121-4/+4
| | | | | | | * fish/rc.c (rc_remote): Close file handle only *after* xdr_destroy, because that latter may flush its file handle (implicated via xdrstdio_create). FYI, this failure is triggered for me only when MALLOC_PERTURB_ is set to nonzero < 256 in my environment.
* Convert all TABs-as-indentation to spaces.Jim Meyering2009-08-031-40/+40
| | | | | | | | | | | Do it by running this command: [exempted files are matched via .x-sc_TAB_in_indentation] git ls-files \ | pcregrep -vf .x-sc_TAB_in_indentation \ | xargs pcregrep -l '^ *\t' \ | xargs perl -MText::Tabs -ni -le \ '$m=/^( *\t[ \t]*)(.*)/; print $m ? expand($1) . $2 : $_'
* Guestfish feature: remote control of guestfish over a pipe.Richard Jones2009-07-141-0/+272
The use case is to have a long-running guestfish process in a shell script, and thus to avoid the overhead of starting guestfish each time. Do: eval `guestfish --listen` guestfish --remote somecmd guestfish --remote someothercmd guestfish --remote exit This patch also supports having multiple guestfish processes at the same time. The protocol is simple XDR messages over a Unix domain socket.