Commit Graph

148 Commits

Author SHA1 Message Date
Michael Tüxen cc96a45c9a Fix a syntax error in a FreeBSD specific code part.
svn path=/trunk/; revision=51728
2013-09-03 17:54:23 +00:00
Guy Harris b65e9e9618 UN*X pathnames + PL/I's comment syntax = surprises. Yay C++ (and C99).
svn path=/trunk/; revision=51347
2013-08-14 00:37:14 +00:00
Guy Harris cfa2dc5f6e Add in more comments on the whole "get the path of the executable from
the kernel" thing, and add the NetBSD and DragonFly BSD /proc links (if
they don't mount /proc, that doesn't work, but it doesn't get in the
way).

On Solaris, check for getexecname, just in case somebody tries to build
on an old Solaris that doesn't support it (that could well end up being
the least of their problems, but at least they won't ask us to diagnose
that one).

svn path=/trunk/; revision=51343
2013-08-13 23:37:32 +00:00
Guy Harris bebe1200de Just check whether dladdr() is available; we check in the code whether
it succeeds, so there's no point in checking whether it succeeds in a
sample program.

svn path=/trunk/; revision=51322
2013-08-12 20:01:30 +00:00
Guy Harris 57b8c51a2e Tell a bit more of the story of dladdr()'s ability, or lack of same, to
return a path for the executable image not based on argv[0].

svn path=/trunk/; revision=51320
2013-08-12 18:51:06 +00:00
Guy Harris 9ff00164a8 Fix a comment.
Fix calls checking the Linux version number.

svn path=/trunk/; revision=51310
2013-08-12 09:18:54 +00:00
Guy Harris f568d56df2 Add in a bunch of UNIX-platform-specific ways of getting executable path
information supplied by the kernel; sadly, we can't trust dladdr() to
use those mechanisms, so we try this first.

Expand the comment about finding the application bundle path given the
executable image path.

svn path=/trunk/; revision=51308
2013-08-12 08:28:34 +00:00
Guy Harris 829a4f213a Add a comment discussing the layout of application bundles and the
directories we should - and perhaps should *not* - set up.

svn path=/trunk/; revision=51307
2013-08-12 01:20:20 +00:00
Guy Harris 237c5a7b60 If we weren't started with special privileges, try to figure out if
we're running from inside an OS X app bundle and, if we are, save the
pathname of the top-level bundle directory and use it to get the
pathnames of global data files, plugins, and Python modules.

This obviates the need to set special environment variables for them in
the launcher scripts, so get rid of the commands to do that.

The @rpathification of binaries also obviates the need for the
commented-out setting of DYLD_LIBRARY_PATH, so get rid of that as well.

svn path=/trunk/; revision=51306
2013-08-12 00:59:34 +00:00
Jeff Morriss 54bb2e7a5c Move report_err.{h,c} from epan into wsutil: there's nothing epan-specific there and moving it avoids having to recompile the file for use in editcap and capinfos (which don't link against libwireshark).
svn path=/trunk/; revision=50598
2013-07-15 02:48:26 +00:00
Guy Harris a28cbb7c8a Put a space between "because" and the next word.
svn path=/trunk/; revision=49706
2013-06-03 02:08:13 +00:00
Guy Harris 6b4c30b69d When allocating the frame table for a NetMon file, use g_try_malloc(),
and fail with ENOMEM if that fails (and the frame table is not empty -
g_try_malloc() will return NULL if you ask it to allocate zero bytes).

Have an error message for ENOMEM on an open that attempts to tell the
user what the problem is without making their head explode.

svn path=/trunk/; revision=49673
2013-06-01 06:48:37 +00:00
Jeff Morriss c2ced4a2ab Don't try to open <home>/.wireshark on Windows: Wireshark hasn't written to
that directory since 2001 and reading from that directory was only left in for
backwards compatibility with versions prior to r4702.  I think it's now safe
to remove that backwards compatibility.

This eliminates the last argument of get_persconffile_path().

https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8437

svn path=/trunk/; revision=48797
2013-04-09 02:48:03 +00:00
Anders Broman b204e38aef Use explicit casts.
svn path=/trunk/; revision=48108
2013-03-05 22:15:20 +00:00
Bill Meier 96a24cc79f Fix spelling/typos found using a list of commonly misspelled words.
The misspellings were mostly in comments but some were
in text strings visible to the user.


svn path=/trunk/; revision=47899
2013-02-26 04:42:26 +00:00
Guy Harris 8ed7a73e22 Fix a bunch of warnings.
Cast away some implicit 64-bit-to-32-bit conversion errors due to use of
sizeof.

Cast away some implicit 64-bit-to-32-bit conversion errors due to use of
strtol() and strtoul().

Change some data types to avoid those implicit conversion warnings.

When assigning a constant to a float, make sure the constant isn't a
double, by appending "f" to the constant.

Constify a bunch of variables, parameters, and return values to
eliminate warnings due to strings being given const qualifiers.  Cast
away those warnings in some cases where an API we don't control forces
us to do so.

Enable a bunch of additional warnings by default.  Note why at least
some of the other warnings aren't enabled.

randpkt.c and text2pcap.c are used to build programs, so they don't need
to be in EXTRA_DIST.

If the user specifies --enable-warnings-as-errors, add -Werror *even if
the user specified --enable-extra-gcc-flags; assume they know what
they're doing and are willing to have the compile fail due to the extra
GCC warnings being treated as errors.

svn path=/trunk/; revision=46748
2012-12-26 05:57:06 +00:00
Guy Harris 016a518728 "Wireshark", in this context, mainly means "libwireshark"; preferences
should be shared by TShark and Wireshark, so the preference directory
path should be independent of the program name.  Program-specific or
GUI-toolkit-specific preferences should be kept in separate files, or
ignored but preserved by programs to which they don't apply.

svn path=/trunk/; revision=45618
2012-10-17 18:10:16 +00:00
Anders Broman edfbd7053b Read the program name rather than hardcoding it.
svn path=/trunk/; revision=45615
2012-10-17 11:42:43 +00:00
Jeff Morriss 3729335973 We always HAVE_CONFIG_H so don't bother checking whether we have it or not.
svn path=/trunk/; revision=45016
2012-09-20 01:48:30 +00:00
Anders Broman 45e9efc6a9 From Evan Huus:
Fix leaks

- don't g_strdup a string just to use it in a g_strdup_printf
- clean up properly in error cases in lua bindings
- misc. other missing g_free() calls
- one missing fclose() in the new 80211_utils

https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7454

svn path=/trunk/; revision=43617
2012-07-09 01:56:27 +00:00
Jakub Zawadzki bf81b42e1e Update Free Software Foundation address.
(COPYING will be updated in next commit)

svn path=/trunk/; revision=43536
2012-06-28 22:56:06 +00:00
Anders Broman e6e6d6217b From Tony Trinh:
Update Lua from 5.1 to 5.2

https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7400

svn path=/trunk/; revision=43482
2012-06-25 20:42:07 +00:00
Chris Maynard e40c7ab1dc Be sure to specify FORMAT_MESSAGE_IGNORE_INSERTS in the dwFlags arg to all FormatMessage() calls where FORMAT_MESSAGE_FROM_SYSTEM is also specified. (Ref: http://blogs.msdn.com/b/oldnewthing/archive/2007/11/28/6564257.aspx)
svn path=/trunk/; revision=43172
2012-06-09 03:41:23 +00:00
Guy Harris 2929c93ea2 When reporting "sorry, *this* packet can't be written to a file of that
type" when writing out a capture file (i.e., writing a
per-packet-encapsulation capture to a file type that supports it but
doesn't support one of the packet's encapsulations), report the packet
number and, when doing this in a merge operation, report the file from
which it came.

When reporting "sorry, that file can't be written to a file of that
type, period", show the file type rather than the input file link-layer
type that causes the problem.  (We could show both.  We could be
*really* ambitious and iterate through all possible file types and show
the ones that will or at least might work....)

file_write_error_message() is documented as handling only UNIX-style
errnos, and libwireshark should be usable without libwiretap, so leave
it up to its callers to handle Wiretap errors such as
WTAP_ERR_SHORT_WRITE.

Clean up indentation.

svn path=/trunk/; revision=39949
2011-11-19 20:18:01 +00:00
Stig Bjørlykke e0c689dc03 Check for NULL pointer in file_exists().
svn path=/trunk/; revision=39318
2011-10-09 09:54:48 +00:00
Bill Meier 16f162eb5d Fix ex "modeline" so it works;
See https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5748

Convert '4 space tabs' to spaces;

svn path=/trunk/; revision=39078
2011-09-21 17:14:14 +00:00
Guy Harris da2d6c8d77 If we're running from the build directory, check the WIRESHARK_SRC_DIR
environment variable, and, if it's set, use it rather than the build
directory as the data file directory.  This is to handle
out-of-source-tree builds.

svn path=/trunk/; revision=38832
2011-09-01 02:35:46 +00:00
Gerald Combs 49b92440de More GLIB_CHECK_VERSION cleanups. Update the minimum GLib/GTK+ versions
in README.devloper. Remove g_gnuc.h since it's no longer needed. Remove
tvbuff_init(), tvbuff_cleanup(), reassemble_init(), and
reassemble_cleanup() since they were only used for older GLib versions
which didn't support GSlices. Assume we always support the "matches"
operator.

svn path=/trunk/; revision=37978
2011-07-11 20:32:19 +00:00
Stig Bjørlykke 8443bbbf75 Replace all strerror() with g_strerror().
Remove our local strerror implementation.
Mark strerror as locale unsafe API.

This fixes bug 5715.

svn path=/trunk/; revision=37812
2011-06-28 09:00:11 +00:00
Guy Harris 4fdcc5c180 Rename ws_stat to ws_stat64, and make it take a pointer to a ws_statb64
as an argument, along the lines of ws_fstat64, and, on Windows, make it
use _wstati64, to handle 64-bit file sizes.

svn path=/trunk/; revision=36547
2011-04-10 20:59:10 +00:00
Jeff Morriss 5a2a122942 Don't put a 65536 byte variable on the stack: instead, malloc/free it.
Coverity 760-761.

svn path=/trunk/; revision=36404
2011-03-29 21:39:15 +00:00
Stig Bjørlykke 03941b54ed Fixed second parameter to create_persconffile_profile.
svn path=/trunk/; revision=36291
2011-03-23 14:58:34 +00:00
Stig Bjørlykke 714c8c52b9 Ensure we create the "Default" personal configuration files directory before
creating a new profile.  This fixes a bug when trying to create a new profile
from a newly installed wireshark with no saved preferences.

svn path=/trunk/; revision=36290
2011-03-23 14:52:39 +00:00
Stig Bjørlykke d188988e83 Added functionality for handling global profiles.
Global profiles can be installed in a "profiles" directory in the
Global configuration directory, and a global profile will be copied
to the users profiles on first time usage.

svn path=/trunk/; revision=36077
2011-02-26 17:23:24 +00:00
Bill Meier 7f0107220d Fix various instances of "unreachable code".
svn path=/trunk/; revision=35713
2011-01-30 23:27:57 +00:00
Jeff Morriss ad47f04c94 Move getenv_utf8() to wsutil.
svn path=/trunk/; revision=35148
2010-12-07 20:24:57 +00:00
Gerald Combs 05c7f620e8 Use g_path_get_dirname in init_progfile_dir on Windows. Leave the
non-Windows code alone since it needs to check for a libtool-ized path.

svn path=/trunk/; revision=35012
2010-11-22 21:05:55 +00:00
Stig Bjørlykke 98f6aa9311 Add a new right-click popup menu for the statusbar profiles for easy functions
to create new, copy, delete and rename configuration profiles.

svn path=/trunk/; revision=34312
2010-10-01 16:29:37 +00:00
Gerald Combs 607b228df6 Add ws_load_library and ws_module_open, which respectively call
LoadLibrary and g_module_open only for the program directory and system
directory on Windows. Use them to replace a bunch of LoadLibrary and
g_module_open calls. Use the extension ".dll" for all the DLLs that we
load. Add comments about DLL loading in Python.

svn path=/trunk/; revision=33924
2010-08-25 20:30:59 +00:00
Anders Broman 26274eb701 From Cal Turney:
Remember folder of capture selected from Welcome screen file dialog.
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5038

svn path=/trunk/; revision=33758
2010-08-10 11:36:18 +00:00
Guy Harris d4cc16d4a1 Handle WTAP_ERR_SHORT_WRITE in file_write_error_message().
In eo_save_entry(), don't assume you can write the entire object in a
single write call - if the object is big enough (which would require a
64-bit address space), and you're not lucky enough to be running on
UN*X (which means LP64, so size_t and ssize_t are big enough for the
entire object), you can't.

svn path=/trunk/; revision=33231
2010-06-16 01:30:29 +00:00
Guy Harris ba5564f32e Squelch some compiler warnings, clean up indentation, clean up a
comment.

svn path=/trunk/; revision=32076
2010-03-02 00:06:20 +00:00
Stig Bjørlykke 2ab6b0f8eb Small rewrite for glib < 2.14 to make it work more than once.
svn path=/trunk/; revision=31340
2009-12-21 17:39:37 +00:00
Stig Bjørlykke 1925a4f5eb Make copy_persconffile_profile work with glib < 2.14.
svn path=/trunk/; revision=31339
2009-12-21 17:28:47 +00:00
Stig Bjørlykke fe793ed781 Added Copy Profile functionality.
svn path=/trunk/; revision=31335
2009-12-21 12:32:31 +00:00
Stig Bjørlykke 3a5c9ec3b2 Load lua scripts in the plugins directory, both global and personal.
List loaded lua scripts in Help->About->Plugins.

svn path=/trunk/; revision=30675
2009-10-23 17:52:18 +00:00
Kovarththanan Rajaratnam 94ff940129 GetModuleFileName expects the size of the passed buffer to be expressed in TCHAR. We currently pass the size expressed in bytes. In other words, we incorrectly state that the buffer is twice as big as it really is.
svn path=/trunk/; revision=30344
2009-10-05 18:38:50 +00:00
Stig Bjørlykke fffe2fdf23 Fixed a typo in a comment.
svn path=/trunk/; revision=28566
2009-06-01 17:28:20 +00:00
Sebastien Tandel 52cc5fb1e8 python binding for wireshark (first commit)
* ability to write dissectors with python for wireshark.
        documentation (http://wiki.wireshark.org/Python)


svn path=/trunk/; revision=28529
2009-05-29 21:10:40 +00:00
Guy Harris 2f6fe511f3 Sigh.
dladdr() in GNU libc isn't available (<dlfcn.h> doesn't define Dl_info)
unless _GNU_SOURCE is defined.

In addition, it's not guaranteed to return anything more useful than
argv[0]; just in case that changes at some point in the future, however,
we still use it, we just run it through the same machinery that we run
argv[0] through.  (On Mac OS X, for example, the path of the executable
is handed to the run-time linker by the kernel, so it *is* useful
there.)

svn path=/trunk/; revision=27821
2009-03-22 18:06:06 +00:00