sxemacs
12 years agoCoverity and build chain fixes from Nelson
Steve Youngs [Tue, 6 Mar 2012 07:32:06 +0000 (17:32 +1000)]
Coverity and build chain fixes from Nelson

* merges:
  Coverity: Resource leak: CID 400015
  Fix configure.ac
  Fix configure
  xstrncpy saga
  xstrncpy saga
  xstrncpy saga
  Fix tty build broken in last configure.ac changes
  Do not add tty objects when no tty is available
  Coverity: CID 400005: Division or modulo by zero
  Coverity: CID 400006: Division or modulo by zero
  Coverity: Out of bounds write: CID 21140
  Coverity: CID 400012 Overrun dynamic
  Fix build for branches without tags
  Coverity CID 400013 Printf arg type mismatch
  Coverity: CID 400031: Tainted string
  Coverity: CID 400829: Uninit
  Use dup2 if available for -t. Also check for ttyname and isatty in configure.
  Coverity: CID 400828 Resource leak
  Use AS_IF instead of if some places - be more M4sh friendly
  Update copyright, remove unused ent arguments

12 years agoMake sure list-load-path-shadows can work after dmp
Nelson Ferreira [Tue, 6 Mar 2012 07:18:10 +0000 (02:18 -0500)]
Make sure list-load-path-shadows can work after dmp

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoMerge branch 'master' of ssh://dio.dreamhost.com/~/repos.nelsonferreira.com/git/sxema...
Nelson Ferreira [Tue, 6 Mar 2012 07:13:23 +0000 (02:13 -0500)]
Merge branch 'master' of ssh://dio.dreamhost.com/~/repos.nelsonferreira.com/git/sxemacs into for-steve

12 years agoCoverity: Resource leak: CID 400015
Nelson Ferreira [Tue, 6 Mar 2012 07:10:19 +0000 (02:10 -0500)]
Coverity: Resource leak: CID 400015

* src/callproc.c (relocate_fd): Make sure that dup'ed file
descriptors < min are closed. In addition, make a better version
when dup2 is available.

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoMerge remote-tracking branch 'njsf/for-steve' into for-steve
Nelson Ferreira [Tue, 6 Mar 2012 06:29:23 +0000 (01:29 -0500)]
Merge remote-tracking branch 'njsf/for-steve' into for-steve

12 years agoFix configure.ac
Nelson Ferreira [Tue, 6 Mar 2012 06:27:19 +0000 (01:27 -0500)]
Fix configure.ac

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoFix configure
Nelson Ferreira [Tue, 6 Mar 2012 06:02:32 +0000 (01:02 -0500)]
Fix configure

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoxstrncpy saga
Nelson Ferreira [Tue, 6 Mar 2012 05:58:48 +0000 (00:58 -0500)]
xstrncpy saga

* src/emodules-ng.c (__emodng_open_append_exts): Use xstrncpy instead of strncpy
* src/emodules-ng.c (__emodng_open_prepend_paths): Ditto.
* src/emodules-ng.c (__emodng_open_prepend_paths_append_exts): Ditto.

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoxstrncpy saga
Nelson Ferreira [Tue, 6 Mar 2012 05:52:11 +0000 (00:52 -0500)]
xstrncpy saga

* src/editfns.c (Ftemp_directory): Use xstrncpy instead of strncpy
and xstrncat instead of strcat

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoxstrncpy saga
Nelson Ferreira [Tue, 6 Mar 2012 05:50:05 +0000 (00:50 -0500)]
xstrncpy saga

* src/database/postgresql.c (Fpq_connectdb): Use xstrncpy instead of strncpy
* src/database/postgresql.c (Fpq_connect_start): Ditto.
* src/database/postgresql.c (Fpq_exec): Ditto.
* src/database/postgresql.c (Fpq_get_result): Ditto.

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoFix tty build broken in last configure.ac changes
Nelson Ferreira [Tue, 6 Mar 2012 05:33:16 +0000 (00:33 -0500)]
Fix tty build broken in last configure.ac changes

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoMerge branch 'for-steve' into njsf-tty
Nelson Ferreira [Tue, 6 Mar 2012 03:08:38 +0000 (22:08 -0500)]
Merge branch 'for-steve' into njsf-tty

12 years agoDo not add tty objects when no tty is available
Nelson Ferreira [Tue, 6 Mar 2012 02:50:30 +0000 (21:50 -0500)]
Do not add tty objects when no tty is available

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoCoverity: CID 400005: Division or modulo by zero
Nelson Ferreira [Tue, 6 Mar 2012 01:57:31 +0000 (20:57 -0500)]
Coverity: CID 400005: Division or modulo by zero

* src/media/sound-oss.c (sound_oss_play): Abort early when channels is 0.

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoCoverity: CID 400006: Division or modulo by zero
Nelson Ferreira [Tue, 6 Mar 2012 00:53:42 +0000 (19:53 -0500)]
Coverity: CID 400006: Division or modulo by zero

* src/ui/window.c (Fwindow_displayed_text_pixel_height): Make sure
no division by 0 is attempted and use "best heuristic" of just
adding 3.

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoCoverity: Out of bounds write: CID 21140
Nelson Ferreira [Mon, 5 Mar 2012 23:04:10 +0000 (18:04 -0500)]
Coverity: Out of bounds write: CID 21140

* src/search.c (boyer_moore): Make it explicit that the value will
always be within the range of the index. Previously it was a side
effect of the downcast to unsigned char, now its explicit.

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoCoverity: CID 400012 Overrun dynamic
Nelson Ferreira [Mon, 5 Mar 2012 22:45:25 +0000 (17:45 -0500)]
Coverity: CID 400012 Overrun dynamic

* lib-src/gnuclient.c (clean_string): Avoid coverity aliasing
shortcomings by reusing the same variable where the length is
calculate for the copy pass.

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoFix build for branches without tags
Nelson Ferreira [Mon, 5 Mar 2012 22:43:17 +0000 (17:43 -0500)]
Fix build for branches without tags

* autogen.sh (emacs_is_beta): Correct the text for branches
without the release tags...

* lib-src/make-dump-id.c: Include the config.h from the proper
directory. This was not an issue for a long time, since there was
always a tag when under git control. make-dump-id was only
compiled then. Now in autogen.sh we will always make sure there is
a tree version, so this will no longer be an issue again.

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoMerge remote-tracking branch 'njsf/for-steve' into for-steve
Nelson Ferreira [Mon, 5 Mar 2012 19:38:46 +0000 (14:38 -0500)]
Merge remote-tracking branch 'njsf/for-steve' into for-steve

12 years agoMerge remote-tracking branch 'origin/master' into for-steve
Nelson Ferreira [Mon, 5 Mar 2012 19:35:38 +0000 (14:35 -0500)]
Merge remote-tracking branch 'origin/master' into for-steve

12 years agoMerge branch 'master' of ssh://dio.dreamhost.com/~/repos.nelsonferreira.com/git/sxema...
Nelson Ferreira [Mon, 5 Mar 2012 19:34:32 +0000 (14:34 -0500)]
Merge branch 'master' of ssh://dio.dreamhost.com/~/repos.nelsonferreira.com/git/sxemacs into for-steve

12 years agoMerge branch 'master' into njsf-cov
Nelson Ferreira [Mon, 5 Mar 2012 19:33:35 +0000 (14:33 -0500)]
Merge branch 'master' into njsf-cov

12 years agoCoverity CID 400013 Printf arg type mismatch
Nelson Ferreira [Mon, 5 Mar 2012 19:33:11 +0000 (14:33 -0500)]
Coverity CID 400013 Printf arg type mismatch

* lib-src/make-path.c: Include string.h so that strerror is
properly defined.

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoCoverity: CID 400031: Tainted string
Nelson Ferreira [Mon, 5 Mar 2012 18:11:52 +0000 (13:11 -0500)]
Coverity: CID 400031: Tainted string

* lib-src/yow.c (main): Make sure argv[2] is not NULL before copying

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoCoverity: CID 400829: Uninit
Nelson Ferreira [Mon, 5 Mar 2012 18:09:31 +0000 (13:09 -0500)]
Coverity: CID 400829: Uninit

* src/media/media.c (Fmedia_stream_aspect): Initialize the
potential return value to nil

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoUse dup2 if available for -t. Also check for ttyname and isatty in configure.
Nelson Ferreira [Mon, 5 Mar 2012 17:52:55 +0000 (12:52 -0500)]
Use dup2 if available for -t. Also check for ttyname and isatty in configure.

* configure.ac: Add some additional functions to check and add the
HAVE_ISATTY and HAVE_TTYNAME

* src/emacs.c (main_1): Enhance the logging of -t with ttyname if
it is available.

* src/emacs.c (main_1): Use raw_open instead of open to avoid
using the format conversion of the filename, which at this early
stage is not setup yet.

* src/emacs.c (main_1): use dup2 if available to dup the opened
file (and then close the original descriptor). This is much more
reliable than close then open, since dup2 will make sure the
descriptor number will be the desired.

* src/eval.c (grow_specpdl): If grow_specpdl is called very early
on specpdl_size is 0 and will loop infinitely here because 2 * 0
== 0 ;)

* src/sysdep.c (raw_open): New function that just calls the system
open with no argument conversion at all

* src/sysfile.h: declare the new raw_open function.

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoCoverity: CID 400828 Resource leak
Nelson Ferreira [Mon, 5 Mar 2012 01:19:52 +0000 (20:19 -0500)]
Coverity: CID 400828 Resource leak

* src/emacs.c (main_1): Make sure second dup is fdesc 1

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoxstrncpy updates from Nelson
Steve Youngs [Sun, 4 Mar 2012 23:22:38 +0000 (09:22 +1000)]
xstrncpy updates from Nelson

* merges:
  xstrncpy saga
  xstrncpy saga
  xstrncpy saga
  xstrncpy saga

12 years agoxstrncpy saga
Nelson Ferreira [Sun, 4 Mar 2012 22:12:24 +0000 (17:12 -0500)]
xstrncpy saga

* src/effi.c (Fffi_load_library): use xstrncpy instead of strncpy, strncat

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoxstrncpy saga
Nelson Ferreira [Sun, 4 Mar 2012 21:57:18 +0000 (16:57 -0500)]
xstrncpy saga

* src/dumper.c (pdump_load): Use xstrncpy instead of strcpy

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoxstrncpy saga
Nelson Ferreira [Sun, 4 Mar 2012 21:55:45 +0000 (16:55 -0500)]
xstrncpy saga

* src/sysdep.c (init_system_name): use xstrncpy instead of strcpy

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoxstrncpy saga
Nelson Ferreira [Sun, 4 Mar 2012 21:51:53 +0000 (16:51 -0500)]
xstrncpy saga

* src/sysdep.c (init_system_name): Use xstrncpy instead of strncpy
* src/sysdep.c (readdir): Ditto.

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoUse AS_IF instead of if some places - be more M4sh friendly
Nelson Ferreira [Sun, 4 Mar 2012 05:00:09 +0000 (00:00 -0500)]
Use AS_IF instead of if some places - be more M4sh friendly

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoUpdate copyright, remove unused ent arguments
Nelson Ferreira [Sun, 4 Mar 2012 04:57:17 +0000 (23:57 -0500)]
Update copyright, remove unused ent arguments

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoVarious build updates from Nelson
Steve Youngs [Sun, 4 Mar 2012 01:48:48 +0000 (11:48 +1000)]
Various build updates from Nelson

* merges:
  Add the new silent-rules options to the list of known configure opts
  Warn about ignored tty 'with' options. Fix if with missing fi
  Add additional tty lib 'with' options
  issue warning when no tty nor window system available
  Enable silent building, ie --enable-silent-rules and make V=0
  Correct the remote configuration command message
  new SXE_CHECK_LINK_LIB macro
  Add summary for additional tty libraries
  Rename git-to-steve -> git-for-steve
  xstrncpy saga
  Better checking of string and memory operations. Also, add define FORBID_STRCPY to make runtime asserts on usage of strcpy, strcat and stpcpy.
  xstrncpy saga
  xstrncpy saga
  xstrncpy saga
  xstrncpy saga

12 years agoAdd the new silent-rules options to the list of known configure opts
Steve Youngs [Sun, 4 Mar 2012 01:48:00 +0000 (11:48 +1000)]
Add the new silent-rules options to the list of known configure opts

* m4/sxe-aux.m4 (_SXE_CHECK_PURE_OPT): Add silent-rules options to
list of known configure opts.

Signed-off-by: Steve Youngs <steve@sxemacs.org>
12 years agoFFI update from Aidan
Steve Youngs [Sun, 4 Mar 2012 01:00:55 +0000 (11:00 +1000)]
FFI update from Aidan

* merges:
  Avoid namespace pollution, runtime consing, #'define-ffi-function

12 years agoAvoid namespace pollution, runtime consing, #'define-ffi-function
Aidan Kehoe [Sat, 3 Mar 2012 15:19:35 +0000 (15:19 +0000)]
Avoid namespace pollution, runtime consing, #'define-ffi-function

12 years agoMerge remote-tracking branch 'njsf/for-steve' into for-steve
Nelson Ferreira [Sat, 3 Mar 2012 05:33:54 +0000 (00:33 -0500)]
Merge remote-tracking branch 'njsf/for-steve' into for-steve

12 years agoMerge branch 'master' of ssh://dio.dreamhost.com/~/repos.nelsonferreira.com/git/sxema...
Nelson Ferreira [Sat, 3 Mar 2012 05:33:34 +0000 (00:33 -0500)]
Merge branch 'master' of ssh://dio.dreamhost.com/~/repos.nelsonferreira.com/git/sxemacs into for-steve

12 years agoWarn about ignored tty 'with' options. Fix if with missing fi
Nelson Ferreira [Sat, 3 Mar 2012 05:30:44 +0000 (00:30 -0500)]
Warn about ignored tty 'with' options. Fix if with missing fi

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoAdd additional tty lib 'with' options
Nelson Ferreira [Sat, 3 Mar 2012 05:17:10 +0000 (00:17 -0500)]
Add additional tty lib 'with' options

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoissue warning when no tty nor window system available
Nelson Ferreira [Sat, 3 Mar 2012 05:14:44 +0000 (00:14 -0500)]
issue warning when no tty nor window system available

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoEnable silent building, ie --enable-silent-rules and make V=0
Nelson Ferreira [Sat, 3 Mar 2012 05:11:28 +0000 (00:11 -0500)]
Enable silent building, ie --enable-silent-rules and make V=0

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoCorrect the remote configuration command message
Nelson Ferreira [Sat, 3 Mar 2012 05:00:23 +0000 (00:00 -0500)]
Correct the remote configuration command message

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agonew SXE_CHECK_LINK_LIB macro
Nelson Ferreira [Sat, 3 Mar 2012 04:53:55 +0000 (23:53 -0500)]
new SXE_CHECK_LINK_LIB macro

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoAdd summary for additional tty libraries
Nelson Ferreira [Sat, 3 Mar 2012 04:51:42 +0000 (23:51 -0500)]
Add summary for additional tty libraries

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoMerge remote-tracking branch 'njsf/for-steve' into for-steve
Nelson Ferreira [Sat, 3 Mar 2012 04:49:39 +0000 (23:49 -0500)]
Merge remote-tracking branch 'njsf/for-steve' into for-steve

12 years agoRename git-to-steve -> git-for-steve
Nelson Ferreira [Sat, 3 Mar 2012 04:48:03 +0000 (23:48 -0500)]
Rename git-to-steve -> git-for-steve

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoxstrncpy saga
Nelson Ferreira [Sat, 3 Mar 2012 04:15:07 +0000 (23:15 -0500)]
xstrncpy saga

* src/fileio.c (file_name_as_directory): Use xstrncpy and change
prototype to take in buffer length.

* src/fileio.c (directory_file_name): Ditto.

* src/fileio.c (Ffile_name_as_directory): properly call
file_name_as_directory with buffer length.
* src/fileio.c (Fdirectory_file_name): ditto.

* src/fileio.c (Fexpand_file_name): Use xstrncat instead of strcat.

* src/fileio.c (Fdirectory_file_name): properly call
directory_file_name with buffer length.

* src/fileio.c (Fsubstitute_in_file_name): use xstrncpy instead of
strcpy keeping track of buffer availability.

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoBetter checking of string and memory operations.
Nelson Ferreira [Sat, 3 Mar 2012 04:07:47 +0000 (23:07 -0500)]
Better checking of string and memory operations.
Also, add define FORBID_STRCPY to make runtime asserts on usage of strcpy, strcat and stpcpy.

* src/sysdep.h: Move xstrlen, xstrcmp, xstrcat, xstrncmp,
xstrncat, xstrncpy, xstpcpy, xstpncpy, xmemcmp, xmemcpy to
sxe-utils.h

* src/sysdep.h (x__dirlen): always_inline..
* src/sysdep.h (x__dirname): ditto.
* src/sysdep.h (xdirname): ditto.

* src/sxe-utils.h (xstrlen): move from sysdep.h
* src/sxe-utils.h (xstrcmp): ditto.
* src/sxe-utils.h (xstrncmp): ditto.
* src/sxe-utils.h (xstrncat): ditto.
* src/sxe-utils.h (xstrncpy): ditto.
* src/sxe-utils.h (xstpcpy): ditto.
* src/sxe-utils.h (xstpncpy): ditto.
* src/sxe-utils.h (xmemcmp): ditto.
* src/sxe-utils.h (xmemcpy): ditto.
* src/sxe-utils.h (xmin_size_t): ditto.

* src/sxe-utils.h (no_strcpy): New forbidden strcpy
* src/sxe-utils.h (no_strcat): New forbidden strcat
* src/sxe-utils.h (no_stpcpy): New forbidden stpcpy

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoxstrncpy saga
Nelson Ferreira [Fri, 2 Mar 2012 22:56:47 +0000 (17:56 -0500)]
xstrncpy saga

* src/dumper.c (pdump_load): Use xstrncpy instead of strncpy

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoxstrncpy saga
Nelson Ferreira [Fri, 2 Mar 2012 22:29:57 +0000 (17:29 -0500)]
xstrncpy saga

* src/sysdep.h (xstrncpy): New inline function.
* src/sysdep.h (xstpncpy): Use xstrncpy instead of strncpy

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoxstrncpy saga
Nelson Ferreira [Fri, 2 Mar 2012 21:20:19 +0000 (16:20 -0500)]
xstrncpy saga

* lib-src/fakemail.c (make_file_preface): Use xstrncpy instead of strncpy
* lib-src/fakemail.c (read_header): ditto.
* lib-src/fakemail.c (main): ditto.
* lib-src/gnuclient.c (main): ditto.
* lib-src/gnuserv.c (handle_ipc_request): ditto.
* lib-src/movemail.c (concat): ditto.
* lib-src/movemail.c (pop_retr): ditto.
* lib-src/movemail.c (pop_retr): ditto.
* lib-src/movemail.c (pop_search_top): ditto.
* lib-src/movemail.c (pop_search_top): ditto.
* lib-src/ootags.c (consider_token): ditto.
* lib-src/ootags.c (C_entries): ditto.
* lib-src/ootags.c (Pascal_functions): ditto.
* lib-src/ootags.c (Prolog_functions): ditto.
* lib-src/ootags.c (Erlang_functions): ditto.
* lib-src/ootags.c (substitute): ditto.
* lib-src/ootags.c (savenstr): ditto.
* lib-src/pop.c (pop_stat): ditto.
* lib-src/pop.c (pop_list): ditto.
* lib-src/pop.c (pop_multi_first): ditto.
* lib-src/pop.c (pop_last): ditto.
* lib-src/pop.c (getok): ditto.
* lib-src/yow.c (main): ditto.

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoxstrncpy saga
Nelson Ferreira [Fri, 2 Mar 2012 21:12:41 +0000 (16:12 -0500)]
xstrncpy saga

* lib-src/etags.c (xstrncpy): cosmetic changes to xstrncpy macro

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoCoverity fixes from Nelson
Steve Youngs [Thu, 1 Mar 2012 23:19:07 +0000 (09:19 +1000)]
Coverity fixes from Nelson

* merges:
  Kill some spurious whitespace
  Coverity: Resource leak: CID 400020
  Coverity: Resource leak: CID 400022
  Coverity: Resource leak: CID 400023
  Coverity: Resource leak: 400024
  Coverity: Stray pointer arithmetic: CID 400000
  Coverity: Division by zero: CID 400004
  Coverity: Resource leak: CID 400025
  Coverity: Resource Leak: CID 400026
  Don't use strncpy, instead use *dest='\0' followed by strncat (with len-1)
  Coverity: CID 21065: Missing break
  Coverity: DEADCODE: CID 583

12 years agoKill some spurious whitespace
Steve Youngs [Thu, 1 Mar 2012 23:18:20 +0000 (09:18 +1000)]
Kill some spurious whitespace

Signed-off-by: Steve Youngs <steve@sxemacs.org>
12 years agoCoverity: Resource leak: CID 400020
Nelson Ferreira [Wed, 29 Feb 2012 21:11:08 +0000 (16:11 -0500)]
Coverity: Resource leak: CID 400020

* src/editfns.c (Ftemp_directory): Check against 0 too. Unlikely
but possible.

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoCoverity: Resource leak: CID 400022
Nelson Ferreira [Wed, 29 Feb 2012 21:07:06 +0000 (16:07 -0500)]
Coverity: Resource leak: CID 400022

* src/emacs.c (main_1): Make sure the temporary descriptor is 0,
which makes the "leak" intentional.

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoCoverity: Resource leak: CID 400023
Nelson Ferreira [Wed, 29 Feb 2012 20:19:03 +0000 (15:19 -0500)]
Coverity: Resource leak: CID 400023

* src/fileio.c (Fcopy_file): make sure ifd is closed

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoCoverity: Resource leak: 400024
Nelson Ferreira [Wed, 29 Feb 2012 20:15:00 +0000 (15:15 -0500)]
Coverity: Resource leak: 400024

* src/fileio.c (Fdo_auto_save): Make sure file is closed

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoCoverity: Stray pointer arithmetic: CID 400000
Nelson Ferreira [Wed, 29 Feb 2012 19:57:22 +0000 (14:57 -0500)]
Coverity: Stray pointer arithmetic: CID 400000

* src/callint.c (Fcall_interactively): add new fcall array, which
is the one allocated, and make args value derive from that. Fill
in function in fcall, and arguments in args.

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoCoverity: Division by zero: CID 400004
Nelson Ferreira [Wed, 29 Feb 2012 19:53:52 +0000 (14:53 -0500)]
Coverity: Division by zero: CID 400004

* src/media/media.c (Fmedia_stream_aspect): assert for den != 0,
with additional check for the "already crashing" scenario.

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoCoverity: Resource leak: CID 400025
Nelson Ferreira [Wed, 29 Feb 2012 19:52:07 +0000 (14:52 -0500)]
Coverity: Resource leak: CID 400025

* src/ui/X11/glyphs-x.c (x_init_image_instance_from_eimage): Free
pixtbl if we are not using it...

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoCoverity: Resource Leak: CID 400026
Nelson Ferreira [Wed, 29 Feb 2012 19:49:01 +0000 (14:49 -0500)]
Coverity: Resource Leak: CID 400026

* src/ui/redisplay.c (add_glyph_rune): Dynarr_free not used
allocated memory.

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoDon't use strncpy, instead use *dest='\0' followed by strncat (with len-1)
Nelson Ferreira [Wed, 29 Feb 2012 18:29:13 +0000 (13:29 -0500)]
Don't use strncpy, instead use *dest='\0' followed by strncat (with len-1)

* lib-src/etags.c (write_classname): use xstrncpy instead of strncpy
* lib-src/etags.c (consider_token): ditto.
* lib-src/etags.c (C_entries): ditto.
* lib-src/etags.c (Pascal_functions): ditto.
* lib-src/etags.c (HTML_lables): ditto.
* lib-src/etags.c (Prolog_functions): ditto.
* lib-src/etags.c (Erlang_functions): ditto.
* lib-src/etags.c (substitute): ditto.
* lib-src/etags.c (readline_internal): ditto.
* lib-src/etags.c (savenstr): ditto.
* lib-src/etags.c (concat): ditto.

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoCoverity: CID 21065: Missing break
Nelson Ferreira [Wed, 29 Feb 2012 15:56:01 +0000 (10:56 -0500)]
Coverity: CID 21065: Missing break

* src/regex.c (common_op_match_null_string_p): Insert missing
brake for set_number_at case.

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoCoverity: DEADCODE: CID 583
Nelson Ferreira [Mon, 27 Feb 2012 04:32:30 +0000 (23:32 -0500)]
Coverity: DEADCODE: CID 583

* src/media/media-internal.c (int2ulaw): Do the assignment outside
of if condition to avoid Coverity false positive and improve code
legibility.

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoCoverity fixes from Nelson
Steve Youngs [Sat, 25 Feb 2012 06:19:43 +0000 (16:19 +1000)]
Coverity fixes from Nelson

* merges:
  Coverity: Overrun static CID: 138
  Coverity: CID 681: TAINTED STRING
  Coverity: CID 610-DEAD CODE 611-UNUSED VALUE
  Coverity: TOCTOU: CID 387
  Coverity:Tainted string: CID 384
  Coverity: Tainted string: CID 386

12 years agoCoverity: Overrun static CID: 138
Nelson Ferreira [Fri, 24 Feb 2012 21:28:20 +0000 (16:28 -0500)]
Coverity: Overrun static CID: 138

* src/dumper.c (pdump_register_struct): Be even more obvious that
control flow ends on abort, which could fall through in the case
of fatal error.

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoCoverity: CID 681: TAINTED STRING
Nelson Ferreira [Fri, 24 Feb 2012 21:26:52 +0000 (16:26 -0500)]
Coverity: CID 681: TAINTED STRING

* src/emacs.c (main): Be even more strict on checks...

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoCoverity: CID 610-DEAD CODE 611-UNUSED VALUE
Nelson Ferreira [Fri, 24 Feb 2012 21:10:44 +0000 (16:10 -0500)]
Coverity: CID 610-DEAD CODE 611-UNUSED VALUE

* lib-src/etags.c (process_file_name): compr was not being used
before anyway so just remove the assignment from the if statement.

* lib-src/etags.c (process_file_name): only make compressed_value
NULL if it was previously not null. But still free it. This means
that after the free we CANNOT dereference it.

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoCoverity: TOCTOU: CID 387
Nelson Ferreira [Fri, 24 Feb 2012 17:51:35 +0000 (12:51 -0500)]
Coverity: TOCTOU: CID 387

* lib-src/etags.c (process_file_name): use open/popen then handle
failure, instead of stat. Also, after successful open check it is
regular file, and reject it is not.

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoCoverity:Tainted string: CID 384
Nelson Ferreira [Fri, 24 Feb 2012 17:47:30 +0000 (12:47 -0500)]
Coverity:Tainted string: CID 384

* lib-src/movemail.c (main): Sanitize argv[optind] so one can mark as fixed

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoCoverity: Tainted string: CID 386
Nelson Ferreira [Fri, 24 Feb 2012 15:36:55 +0000 (10:36 -0500)]
Coverity: Tainted string: CID 386

* src/emacs.c (main): Do sanity checking on the arguments

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoReally fix FreeBSD -fstack-protector builds
Steve Youngs [Thu, 23 Feb 2012 06:58:37 +0000 (16:58 +1000)]
Really fix FreeBSD -fstack-protector builds

* freebsd-ssp:
  Fix building on FreeBSD with -fstack-protector.

12 years agoFix building on FreeBSD with -fstack-protector.
Steve Youngs [Thu, 23 Feb 2012 06:57:06 +0000 (16:57 +1000)]
Fix building on FreeBSD with -fstack-protector.

So, as it turns out, FreeBSD CAN build SXEmacs with -fstack-protector.
But only if you DON'T link with libssp.  Who knew?

* m4/sxe-compiler.m4 (SXE_STACK_FLAGS): Re-work so that on FreeBSD
libssp is NOT used, while it is everywhere else.

Signed-off-by: Steve Youngs <steve@sxemacs.org>
12 years agoCoverity fixes, etc from Nelson
Steve Youngs [Thu, 23 Feb 2012 00:06:52 +0000 (10:06 +1000)]
Coverity fixes, etc from Nelson

* merges:
  Coverity: TOCTOU: CID 392
  Fix build...
  Coverity: TOCTOU: CID 391
  Coverity: TOCTOU: CID 390
  Coverity: TOCTOU: CID 387
  Better stack-protector behavior in FreeBSD
  Remove forceful disable of ase in Mac OS X
  Coverity CID 52: Forward null
  Slightly better basic type detection.

12 years agoCoverity: TOCTOU: CID 392
Nelson Ferreira [Wed, 22 Feb 2012 23:38:13 +0000 (18:38 -0500)]
Coverity: TOCTOU: CID 392

* src/editfns.c (Ftemp_directory): First mkdir then properly
handle errors for the home directory temp directory creation.
Also attempt to create .created_by_sxemacs in case the dir exists.

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoFix build...
Nelson Ferreira [Wed, 22 Feb 2012 23:36:01 +0000 (18:36 -0500)]
Fix build...

* src/ui/X11/xgccache.c (gc_cache_lookup): NULL not null

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoCoverity: TOCTOU: CID 391
Nelson Ferreira [Wed, 22 Feb 2012 23:33:17 +0000 (18:33 -0500)]
Coverity: TOCTOU: CID 391

* lib-src/ootags.c (process_file): Check for regular file after
open, even if it fails, to improve diagnostic message.

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoCoverity: TOCTOU: CID 390
Nelson Ferreira [Wed, 22 Feb 2012 23:29:43 +0000 (18:29 -0500)]
Coverity: TOCTOU: CID 390

* lib-src/movemail.c (main): No need to check access to outname,
since open will fail and we are not giving any better diagnosis.

* lib-src/movemail.c (main): Ditto for inname.

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoCoverity: TOCTOU: CID 387
Nelson Ferreira [Wed, 22 Feb 2012 23:23:46 +0000 (18:23 -0500)]
Coverity: TOCTOU: CID 387

* lib-src/make-path.c (touchy_mkdir): Try to avoid check/create
race condition by first attempting to create, then check any
error. If it is EEXISTS or directory already exists, then all
good.

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoMerge branch 'njsf-cov' into for-steve
Nelson Ferreira [Wed, 22 Feb 2012 22:49:47 +0000 (17:49 -0500)]
Merge branch 'njsf-cov' into for-steve

12 years agoBetter stack-protector behavior in FreeBSD
Nelson Ferreira [Wed, 22 Feb 2012 22:49:38 +0000 (17:49 -0500)]
Better stack-protector behavior in FreeBSD

* m4/sxe-compiler.m4 (SXE_STACK_FLAGS): Forcefully disable stack-protector on freebsd and output warning message..

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoRemove forceful disable of ase in Mac OS X
Nelson Ferreira [Wed, 22 Feb 2012 22:48:22 +0000 (17:48 -0500)]
Remove forceful disable of ase in Mac OS X

* configure.ac: Remove conditional on opsys != darwin for ase
inclusion. Make conditional on ase components depend on having
dynamic or static ase, not on OS...

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoMerge remote-tracking branch 'origin/master' into for-steve
Nelson Ferreira [Wed, 22 Feb 2012 21:52:45 +0000 (16:52 -0500)]
Merge remote-tracking branch 'origin/master' into for-steve

12 years agoaRts removal from Horst
Steve Youngs [Wed, 22 Feb 2012 03:49:44 +0000 (13:49 +1000)]
aRts removal from Horst

* merges:
  [aRts removal] Exorcizo te, omnis spiritus immunde, in nomine Dei Patris omnipotentis
  ex{|or}cise the monstrosity that is aRts once and for all

12 years ago[aRts removal] Exorcizo te, omnis spiritus immunde, in nomine Dei Patris omnipotentis
Horst G. Burkhardt III [Wed, 22 Feb 2012 02:55:21 +0000 (13:55 +1100)]
[aRts removal] Exorcizo te, omnis spiritus immunde, in nomine Dei Patris omnipotentis

Signed-off-by: Horst G. Burkhardt III <horst@sxemacs.org>
12 years agoex{|or}cise the monstrosity that is aRts once and for all
Horst G. Burkhardt III [Wed, 22 Feb 2012 01:09:40 +0000 (12:09 +1100)]
ex{|or}cise the monstrosity that is aRts once and for all

Signed-off-by: Horst G. Burkhardt III <horst@sxemacs.org>
12 years agoPROBLEMS update re SSP on FreeBSD from Horst
Steve Youngs [Sat, 18 Feb 2012 15:01:25 +0000 (01:01 +1000)]
PROBLEMS update re SSP on FreeBSD from Horst

* merges:
  added warning against SSP on FreeBSD to PROBLEMS file

12 years agoadded warning against SSP on FreeBSD to PROBLEMS file
Horst G. Burkhardt III [Sat, 18 Feb 2012 00:48:24 +0000 (11:48 +1100)]
added warning against SSP on FreeBSD to PROBLEMS file

Signed-off-by: Horst G. Burkhardt III <horst@sxemacs.org>
12 years agoCoverity CID 52: Forward null
Nelson Ferreira [Sat, 11 Feb 2012 02:07:57 +0000 (21:07 -0500)]
Coverity CID 52: Forward null

* src/ui/X11/xgccache.c (gc_cache_lookup): Only dereference
cell/cache->head if not NULL

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
12 years agoMerge remote-tracking branch 'origin/master' into for-steve
Nelson Ferreira [Wed, 1 Feb 2012 16:15:57 +0000 (11:15 -0500)]
Merge remote-tracking branch 'origin/master' into for-steve

12 years agoMerge branch 'openindie'
Steve Youngs [Tue, 31 Jan 2012 02:34:08 +0000 (12:34 +1000)]
Merge branch 'openindie'

* openindie:
  Fix build on OpenIndiana

12 years agoFix build on OpenIndiana
Steve Youngs [Tue, 31 Jan 2012 02:31:43 +0000 (12:31 +1000)]
Fix build on OpenIndiana

"Fix" is probably too strong a word here, it wasn't really broken in the
first place.  Just a tiny tweak to autogen.sh was the only "fix" needed
here.

This changeset also documents (in PROBLEMS) the missing deps needed to
build SXEmacs on OpenIndiana.

* autogen.sh: Only add the xpg4/bin directory to the $PATH if this
isn't OpenIndiana.

* PROBLEMS: Document build quirks for OpenIndiana.

Signed-off-by: Steve Youngs <steve@sxemacs.org>
12 years agoThe Great Whitespace Cleanup
Steve Youngs [Sat, 28 Jan 2012 08:01:03 +0000 (18:01 +1000)]
The Great Whitespace Cleanup

* whitespace: (24 commits)
  Whitespace cleanup in src [m-z]
  Whitespace cleanup in src [f-l]
  Whitespace cleanup in src [a-e]
  Whitespace cleanup in src/database
  Whitespace cleanup in src/ent
  Whitespace cleanup in src/events
  Whitespace cleanup in src/m
  Whitespace cleanup in src/media
  Whitespace cleanup in src/mem
  Whitespace cleanup in src/mule
  Whitespace cleanup in src/s
  Whitespace cleanup in src/ui
  Whitespace cleanup in src/ui/lwlib
  Whitespace cleanup in src/ui/X11
  Whitespace cleanup in src/ui/TTY
  Whitespace cleanup in tests
  Whitespace cleanup in modules
  Whitespace cleanup in m4
  Whitespace cleanup in lisp
  Whitespace cleanup in lib-src
  ...

12 years agoWhitespace cleanup in src [m-z]
Steve Youngs [Sat, 28 Jan 2012 07:41:50 +0000 (17:41 +1000)]
Whitespace cleanup in src [m-z]

Signed-off-by: Steve Youngs <steve@sxemacs.org>
12 years agoWhitespace cleanup in src [f-l]
Steve Youngs [Sat, 28 Jan 2012 07:27:57 +0000 (17:27 +1000)]
Whitespace cleanup in src [f-l]

Signed-off-by: Steve Youngs <steve@sxemacs.org>
12 years agoWhitespace cleanup in src [a-e]
Steve Youngs [Sat, 28 Jan 2012 07:22:02 +0000 (17:22 +1000)]
Whitespace cleanup in src [a-e]

Signed-off-by: Steve Youngs <steve@sxemacs.org>