summaryrefslogtreecommitdiff
path: root/sal/osl/unx/pipe.cxx
AgeCommit message (Collapse)Author
2019-07-19cid#1448293 Copy into fixed size bufferCaolán McNamara
Change-Id: I0ff36c58bf2448bdccc239582ba24b69c7431c6d Reviewed-on: https://gerrit.libreoffice.org/75921 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2019-07-18cid#1448288 Unchecked return value from libraryCaolán McNamara
Change-Id: Id1b8044126e65e67b2496cf7a4eb86b54ba6c1df Reviewed-on: https://gerrit.libreoffice.org/75872 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2019-02-09loplugin:indentation in registry..saxNoel Grandin
Change-Id: I4b877751818febaec8e64018335dca691a476a43 Reviewed-on: https://gerrit.libreoffice.org/67561 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-01-16Use OString for memory management of osl_psz_createPipeStephan Bergmann
...and make sure that the generated name is actually short enough to be stored in a sockaddr_un::sun_path. (oslPipeImpl::m_Name is only used to store such a name, to be used in osl_closePipe, so just make it of the same size to guarantee that copying between the two with strcpy will always work.) Change-Id: I6d1d0c5518e6d09eff129d682a1a334d12201e90 Reviewed-on: https://gerrit.libreoffice.org/66469 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-01-16Use OString for memory management of getBootstrapSocketPathStephan Bergmann
Change-Id: If1187cbb428d329fa10070662282d7fc3aeaf9de Reviewed-on: https://gerrit.libreoffice.org/66441 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-01-16New loplugin:emptyStephan Bergmann
Change-Id: I8729db064573ac21dfe6b203c5ae244d79ecc4fe Reviewed-on: https://gerrit.libreoffice.org/66430 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-11-01Fix build on HaikuKacper Kasper
Change-Id: I4a21258c2405bd6e5c539ec0206e28a316c6ce13 Reviewed-on: https://gerrit.libreoffice.org/60835 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-10-19Introduce UnixErrnoString() and use it in sal/osl/unxTor Lillqvist
The UnixErrnoString() function returns the symbolic name of an errno value, like "ENOENT". For now this is local to sal/osl/unx. If it can't figure out the symbolic name, it returns it as a number followed by the cleartext description (as from strerror()) in parentheses. Rationale why to use this and not strerror(): This is intended to be used in SAL_INFO() and SAL_WARN(). Such messages are intended to be read by developers, not end-users. Developers are (or should be) familiar with symbolic errno names in code anyway. The symbolic names of errno values are (or should be) instantly recognizable as such, they all start with E and are in UPPERCASE. strerror() can be localised although in LibreOffice it apparently isn't as there allegedly aren't setlocale() calls. But, anyway, the error strings might be less familiar to a developer than the symbolc errno names that one uses when coding. When encountering an unfamiliar error string the developer might want to add special handling for that error case in the code. They would need a reverse mapping from error string to errno value, by manually searching <errno.h>, looking at the comments there, hoping the match what strerror() produces, to find the corresponding symbolic errno value. Change-Id: Idc11595d528e8432a32bf474e6791f4ea7262a1e Reviewed-on: https://gerrit.libreoffice.org/61931 Tested-by: Jenkins Reviewed-by: Tor Lillqvist <tml@collabora.com>
2018-10-18loplugin:staticvar in hwpfilter..salNoel Grandin
Change-Id: I8bf3509637cb295847e0dd667c1862269a192bbe Reviewed-on: https://gerrit.libreoffice.org/61881 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-12loplugin:constfields in reportdesign,sal,saxNoel Grandin
and improve the rewriter so I spend less time fixing formatting Change-Id: Ic2a6e5e31a5a202d2d02a47d77c484a57a5ec514 Reviewed-on: https://gerrit.libreoffice.org/61676 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-09-17New loplugin:externalStephan Bergmann
...warning about (for now only) functions and variables with external linkage that likely don't need it. The problems with moving entities into unnamed namespacs and breaking ADL (as alluded to in comments in compilerplugins/clang/external.cxx) are illustrated by the fact that while struct S1 { int f() { return 0; } }; int f(S1 s) { return s.f(); } namespace N { struct S2: S1 { int f() { return 1; } }; int f(S2 s) { return s.f(); } } int main() { return f(N::S2()); } returns 1, both moving just the struct S2 into an nunnamed namespace, struct S1 { int f() { return 0; } }; int f(S1 s) { return s.f(); } namespace N { namespace { struct S2: S1 { int f() { return 1; } }; } int f(S2 s) { return s.f(); } } int main() { return f(N::S2()); } as well as moving just the function f overload into an unnamed namespace, struct S1 { int f() { return 0; } }; int f(S1 s) { return s.f(); } namespace N { struct S2: S1 { int f() { return 1; } }; namespace { int f(S2 s) { return s.f(); } } } int main() { return f(N::S2()); } would each change the program to return 0 instead. Change-Id: I4d09f7ac5e8f9bcd6e6bde4712608444b642265c Reviewed-on: https://gerrit.libreoffice.org/60539 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-07-27Related: rhbz#1602589 add comments to coverity annotationsCaolán McNamara
Change-Id: I88c941832a0d682ea4b6028c28edd48cf5df38f7 Reviewed-on: https://gerrit.libreoffice.org/58093 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-01-12More loplugin:cstylecast: salStephan Bergmann
auto-rewrite with <https://gerrit.libreoffice.org/#/c/47798/> "Enable loplugin:cstylecast for some more cases" plus solenv/clang-format/reformat-formatted-files Change-Id: I7d89b011464ba5d2dd12e04d5fc9f65cb4daebde
2017-12-11loplugin:salcall fix functionsNoel Grandin
since cdecl is the default calling convention on Windows for such functions, the annotation is redundant. Change-Id: I1a85fa27e5ac65ce0e04a19bde74c90800ffaa2d Reviewed-on: https://gerrit.libreoffice.org/46164 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-11-23loplugin:simplifybool for negation of comparison operatorNoel Grandin
Change-Id: Ie56daf560185274754afbc7a09c432b5c2793791 Reviewed-on: https://gerrit.libreoffice.org/45068 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-07-21osl: Unix pipe converted from OSL_ASSERT to assert/SAL_WARNsChris Sherlock
Explanation for each conversion: - osl_acceptPipe() - don't worry about an invalid oslPipe sent as function parameter an error gets flagged in Unix normally, so it might not be a programming error - definitely assert on an empty name, that's a definite programming error and should never, ever occur - createPipeImpl() allocates and initializes memory for the oslPipeImpl structure, if it can't do this then something has been done wrongly - osl_receivePipe() - invalid oslPipe sent as function parameter might not be a programming error, give a warning but don't assert - osl_sendPipe() - invalid oslPipe sent as function parameter might not be a programming error, give a warning but don't assert - osl_writePipe() - really just a thin wrapper around osl_sendPipe(), which detects and handles invalid pipes - osl_readPipe() - really just a thin wrapper around osl_receivePipe(), which detects and handles invalid pipes Change-Id: I4923265b4c648852743c406b682d43ffb9ac6537 Reviewed-on: https://gerrit.libreoffice.org/40003 Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com> Tested-by: Chris Sherlock <chris.sherlock79@gmail.com>
2017-07-02loplugin:casttovoid: salStephan Bergmann
Change-Id: I70cf54799f08e3bc586d42d6c634eb02a049ea0f
2017-06-26loplugin:oncevar in oox..saxNoel Grandin
Change-Id: I0fee8bcddaeea48335e3be05761d2ad2c45020e2 Reviewed-on: https://gerrit.libreoffice.org/39238 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-06-25osl: socket.cxx nullptr comparison cleanupsChris Sherlock
Change-Id: Ie0339482bf3a9b108e26008526bc5e73b761d27b Reviewed-on: https://gerrit.libreoffice.org/39223 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-06-25osl: remove comment cruft from pipe.cxx on win32 and unxChris Sherlock
Change-Id: I774497c07f682a3923a6317af5804e477540995c Reviewed-on: https://gerrit.libreoffice.org/39225 Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com> Tested-by: Chris Sherlock <chris.sherlock79@gmail.com>
2017-06-25osl: whitespace cleanup of pipe.cxx for unx and w32Chris Sherlock
Change-Id: I9c8933616d36027314c990301e67a54c567429b5 Reviewed-on: https://gerrit.libreoffice.org/39222 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com>
2017-05-16Extend loplugin:comparisonwithconstant beyond integral typesStephan Bergmann
Change-Id: Id3a8fd5d8b9975d3ae49af0648b39454310495fa
2017-05-16Try to fix loplugin:comparisonwithconstant's rewrite-with-macros issueStephan Bergmann
...that had plagued 2e293a731c1559c9869dfcb32491bc600fc18e4e "new loplugin/rewriter comparisonwithconstant" (in sal/osl/unx/pipe.cxx), and auto-rewrite the remaining occurrences in sal (that the mentioned commit had failed to address, for whatever reason) Change-Id: I3dc3bae8dd92ba8bf576f6e06e7c9ee21f883661
2017-04-12clang-tidy: readability-else-after-returnNoel Grandin
run it against sal,cppu,cppuhelper I had to run this multiple times to catch all the cases in each module, and it requires some hand-tweaking of the resulting output - clang-tidy is not very good about cleaning up trailing spaces, and aligning things nicely. Change-Id: I00336345f5f036e12422b98d66526509380c497a Reviewed-on: https://gerrit.libreoffice.org/36194 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-03-10Drop __osl_ prefix from static entities (avoid reserved identifiers)Stephan Bergmann
Change-Id: I725783d10bc1e6300c480542c536d409433ff532
2016-03-02tdf#98210 do not require R_OK for pipe dirHank Leininger
Also better error handling if pipe dirs are really not usable. Change-Id: I1c865b9a9f1f08d2cffd07343494feca585ec75e Reviewed-on: https://gerrit.libreoffice.org/22727 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: jan iversen <jani@documentfoundation.org>
2016-02-07Platforms that need CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT for sockets usuallyDamjan Jovanovic
need it for pipes too, and even if it isn't necessary it can't hurt. In particular, on FreeBSD 11-CURRENT it seems pipes no longer wake up from accept when closed in other threads, so let's deal with that before FreeBSD 11 is released. Reported by: Matthias Apitz <g u r u a t u n i x a r e a d o t d e> Patch by: me Tested by: Matthias Apitz <g u r u a t u n i x a r e a d o t d e> (cherry picked from commit e18ecd4f644cfbe5d6b871c7ff6c76bd5c220504) Change-Id: I1b4c0438fbcc2ea53625f235906936fc1403e195
2015-11-10loplugin:nullptr (automatic rewrite)Stephan Bergmann
Change-Id: I1bc6c87fcd6e5e96362623be94c59be216a3b2b8
2015-04-15remove unnecessary use of void in function declarationsNoel Grandin
ie. void f(void); becomes void f(); I used the following command to make the changes: git grep -lP '\(\s*void\s*\)' -- *.cxx \ | xargs perl -pi -w -e 's/(\w+)\s*\(\s*void\s*\)/$1\(\)/g;' and ran it for both .cxx and .hxx files. Change-Id: I314a1b56e9c14d10726e32841736b0ad5eef8ddd
2015-03-30Return value 0 from connect() is not an error, errno is not setTor Lillqvist
No need to SAL_WARN it, it is a common non-exceptional case (when attempting to start a second LO instance). Change-Id: I26f2939d2f5b97ddfcc9e912e578b706567b3912
2015-03-28Clean up C-style casts from pointers to voidStephan Bergmann
Change-Id: I5e370445affbcd32b05588111f74590bf24f39d6
2015-02-23remove unnecessary parenthesis in return statementsNoel Grandin
found with $ git grep -lP 'return\s*\(\s*\w+\s*\)\s*;' Change-Id: Ic51606877a9edcadeb647c5bf17bc928b69ab60e
2015-02-03Let's use log tags starting with "sal" here in salTor Lillqvist
2015-02-03Fix typoTor Lillqvist
Change-Id: I4f96972255ca99debd53d4302073d1823cc27492
2015-02-03Improve logging, change OSL_TRACE into SAL_WARN and SAL_INFOTor Lillqvist
Change-Id: I37a0003ca321ca788f7885eb9fdea69ed388a35d
2015-02-03Bin stupid macro that was used just onceTor Lillqvist
Change-Id: I2e7528cb374d621f148d559c51521013bba62477
2015-02-03Bin code that has been commented out since initial importTor Lillqvist
Change-Id: Ie96cf3043b126577087eadae5900489a5eb84bcf
2015-01-20Some more loplugin:cstylecast: salStephan Bergmann
Change-Id: Ie54d340478412e62b87d66e287fd8a3963e97898
2014-12-19fdo#39440 sal: reduce scope of local variablesMichael Weghorn
This addresses some cppcheck warnings. Change-Id: Id5f90757571e76a2c05a4cbd37020e1f6a6b2033 Reviewed-on: https://gerrit.libreoffice.org/13544 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
2014-11-21Silence false cid#1255391 TOCTOU warningStephan Bergmann
Change-Id: Ifc35c379d5c68fb363ae3507ccb5bff37c8cd9aa
2014-11-19system.h -> system.hxxStephan Bergmann
Change-Id: I39a60d0b775bfe40fa89e8b5d5f7466d0db5d36e
2014-11-19sockimpl.h -> sockimpl.hxxStephan Bergmann
Change-Id: Ic11f5e0923b8b9d656b74b900f52ff154bb65971
2014-11-19secimpl.h -> secimpl.hxxStephan Bergmann
Change-Id: I0fb87c5658bd02e327df8fdf3e0aa79f20bbc111
2014-11-19pipe.c -> pipe.cxxStephan Bergmann
Change-Id: I0c9659379e6120c0bf01b6436d3127b83ad01af1