Commit Graph

8 Commits

Author SHA1 Message Date
Ondrej Holy
087525b62b gio-tool: Use print_file_error correctly
Use print_file_error where an error relates to that file and vice versa.

https://bugzilla.gnome.org/show_bug.cgi?id=786463
2017-08-18 14:46:23 +02:00
Ondrej Holy
37cddec0ee gio-tool: Unify buffer sizes
Recently, buffer size for copying has been increased in order to improve
performance:
https://bugzilla.gnome.org/show_bug.cgi?id=773823

Let's do the same for gio-tool-save and gio-tool-cat.

https://bugzilla.gnome.org/show_bug.cgi?id=786460
2017-08-18 14:46:23 +02:00
Philip Withnall
5cddde1fb2 Consistently save errno immediately after the operation setting it
Prevent the situation where errno is set by function A, then function B
is called (which is typically _(), but could be anything else) and it
overwrites errno, then errno is checked by the caller.

errno is a horrific API, and we need to be careful to save its value as
soon as a function call (which might set it) returns. i.e. Follow the
pattern:
  int errsv, ret;
  ret = some_call_which_might_set_errno ();
  errsv = errno;

  if (ret < 0)
    puts (strerror (errsv));

This patch implements that pattern throughout GLib. There might be a few
places in the test code which still use errno directly. They should be
ported as necessary. It doesn’t modify all the call sites like this:
  if (some_call_which_might_set_errno () && errno == ESOMETHING)
since the refactoring involved is probably more harmful than beneficial
there. It does, however, refactor other call sites regardless of whether
they were originally buggy.

https://bugzilla.gnome.org/show_bug.cgi?id=785577
2017-08-03 10:21:13 +01:00
Sébastien Wilmet
3bf4a720c3 gio/: LGPLv2+ -> LGPLv2.1+
Sub-directories inside gio/ already processed in a previous commit:
- fam/
- gdbus-2.0/ (which contains only codegen/)
- gvdb/
- inotify/
- tests/
- win32/
- xdgmime/

Other sub-directories inside gio/:
- completion/: no license headers
- kqueue/: not LGPL, BSD-style license

https://bugzilla.gnome.org/show_bug.cgi?id=776504
2017-05-29 19:53:34 +02:00
Ondrej Holy
fb7d2184a6 gio-tool: Do not leak GOptionContext
GOptionContext is freed only in case of success. Free the context
also in case of failure.

https://bugzilla.gnome.org/show_bug.cgi?id=776169
2017-04-10 10:14:04 +02:00
Ondrej Holy
0beeeb2ec9 gio-tool: Various fixes related to error messages
This patch contains the following changes:
- Print all errors with "gio: " prefix
- Print file uri in error for each tool allowing multiple locations
- Mark all error messages translatable
- Do not leak strings used in error messages
- Always start error messages with capital letter
- Unify some error messages across various tools
- Fix addional/missing new line characters

https://bugzilla.gnome.org/show_bug.cgi?id=776169
2017-04-10 10:14:04 +02:00
Chun-wei Fan
b08a8dc949 gio tool: Fix build on Windows/non-GCC
The recently-added GIO tools is intended to be built on all platforms, so
adjust the code a bit to enable this:

-Use gssize instead of ssize_t, as ssize_t is not supported by all
 compilers.
-Include io.h on Windows, and define STDIN_FILENO and STDOUT_FILENO if
 necessary on Windows.

https://bugzilla.gnome.org/show_bug.cgi?id=768357
2016-07-16 23:03:48 -04:00
Matthias Clasen
9edba4e49c Add a new gio commandline tool
This command collects the various commandline utilities that
are currently shipped in gvfs, and unifies them under a single,
command-style binary.

The tools just use GIO APIs, so it makes sense for them to live here.
2016-07-01 16:01:34 -04:00