[PATCH] Define PATH_MAX if it's not defined
Dirk Hohndel
dirk at hohndel.org
Wed Aug 27 15:49:23 PDT 2014
Just realized that this patch is lacking your Signed-off-by:
I assume it's ok for me to add that for you?
/D
On Wed, Aug 27, 2014 at 11:12:05PM +0200, Salvo 'LtWorf' Tomaselli wrote:
> Fixes FTBFS on Hurd.
> Also makes sure that if the file is truncated, there is a way of
> knowing what is happening.
> ---
> qt-ui/subsurfacewebservices.cpp | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/qt-ui/subsurfacewebservices.cpp b/qt-ui/subsurfacewebservices.cpp
> index c3661e0..4111f8c 100644
> --- a/qt-ui/subsurfacewebservices.cpp
> +++ b/qt-ui/subsurfacewebservices.cpp
> @@ -29,6 +29,10 @@
> #include <QUrlQuery>
> #endif
>
> +#ifndef PATH_MAX
> +#define PATH_MAX 260
> +#endif
> +
> struct dive_table gps_location_table;
> static bool merge_locations_into_dives(void);
>
> @@ -194,7 +198,9 @@ bool DivelogsDeWebServices::prepare_dives_for_divelogs(const QString &tempfile,
> /*
> * Save the XML document into a zip file.
> */
> - snprintf(filename, PATH_MAX, "%d.xml", i + 1);
> + if (snprintf(filename, PATH_MAX, "%d.xml", i + 1)>= PATH_MAX) {
> + report_error(tr("long path was truncated").toUtf8());
> + }
> s = zip_source_buffer(zip, membuf, streamsize, 1);
> if (s) {
> int64_t ret = zip_add(zip, filename, s);
> --
> 2.1.0
>
> _______________________________________________
> subsurface mailing list
> subsurface at hohndel.org
> http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface
More information about the subsurface
mailing list