[haiku-commits] haiku: hrev46685 - src/kits/network/libnetapi

  • From: pulkomandy@xxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 16 Jan 2014 09:29:31 +0100 (CET)

hrev46685 adds 2 changesets to branch 'master'
old head: 969fac14a7363e96cd67d2dda6ee3ef5a8c9bada
new head: 3db38646441a243c19322357ebc110fd1240db24
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=3db3864+%5E969fac1

----------------------------------------------------------------------------

385a7d8: More style fixes.

3db3864: Fix crash when trying to open a non-existing file.

                             [ Adrien Destugues <pulkomandy@xxxxxxxxxxxxx> ]

----------------------------------------------------------------------------

2 files changed, 8 insertions(+), 3 deletions(-)
src/kits/network/libnetapi/Certificate.cpp | 6 ++++--
src/kits/network/libnetapi/FileRequest.cpp | 5 ++++-

############################################################################

Commit:      385a7d89b7be5f3a5fed82084e70e4f06e25b8cb
URL:         http://cgit.haiku-os.org/haiku/commit/?id=385a7d8
Author:      Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Date:        Thu Jan 16 07:28:58 2014 UTC

More style fixes.

----------------------------------------------------------------------------

diff --git a/src/kits/network/libnetapi/Certificate.cpp 
b/src/kits/network/libnetapi/Certificate.cpp
index 3f711a8..a8cd129 100644
--- a/src/kits/network/libnetapi/Certificate.cpp
+++ b/src/kits/network/libnetapi/Certificate.cpp
@@ -14,7 +14,8 @@
 #ifdef OPENSSL_ENABLED
 
 
-static time_t parse_ASN1(ASN1_GENERALIZEDTIME *asn1)
+static time_t
+parse_ASN1(ASN1_GENERALIZEDTIME *asn1)
 {
        // Get the raw string data out of the ASN1 container. It looks like 
this:
        // "YYMMDDHHMMSSZ"
@@ -29,7 +30,8 @@ static time_t parse_ASN1(ASN1_GENERALIZEDTIME *asn1)
 }
 
 
-static BString decode_X509_NAME(X509_NAME* name)
+static BString
+decode_X509_NAME(X509_NAME* name)
 {
        int len = X509_NAME_get_text_by_NID(name, 0, NULL, 0);
        char buffer[len];

############################################################################

Revision:    hrev46685
Commit:      3db38646441a243c19322357ebc110fd1240db24
URL:         http://cgit.haiku-os.org/haiku/commit/?id=3db3864
Author:      Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Date:        Thu Jan 16 08:28:42 2014 UTC

Fix crash when trying to open a non-existing file.

----------------------------------------------------------------------------

diff --git a/src/kits/network/libnetapi/FileRequest.cpp 
b/src/kits/network/libnetapi/FileRequest.cpp
index 28aa1db..4a3b05c 100644
--- a/src/kits/network/libnetapi/FileRequest.cpp
+++ b/src/kits/network/libnetapi/FileRequest.cpp
@@ -43,6 +43,7 @@ status_t
 BFileRequest::_ProtocolLoop()
 {
        BNode node(fUrl.Path().String());
+
        if (node.IsSymLink()) {
                // Traverse the symlink and start over
                BEntry entry(fUrl.Path().String(), true);
@@ -84,12 +85,14 @@ BFileRequest::_ProtocolLoop()
                return B_OK;
        }
 
-       assert(node.IsDirectory());
        node_ref ref;
        status_t error = node.GetNodeRef(&ref);
+
+       // Stop here, and don't hit the assert below, if the file doesn't exist.
        if (error != B_OK)
                return error;
 
+       assert(node.IsDirectory());
        BDirectory directory(&ref);
 
        fResult.SetContentType("application/x-ftp-directory; charset=utf-8");


Other related posts: