Index: runtime/kioslave/smb/kio_smb_browse.cpp
===================================================================
--- runtime/kioslave/smb/kio_smb_browse.cpp	(revision 804348)
+++ runtime/kioslave/smb/kio_smb_browse.cpp	(working copy)
@@ -44,19 +44,25 @@
 
 int SMBSlave::cache_stat(const SMBUrl &url, struct stat* st )
 {
+    int cacheStatErr;
     int result = smbc_stat( url.toSmbcUrl(), st);
-    kDebug(KIO_SMB) << "smbc_stat " << url << " " << errno << " " << result;
+    if (result == 0){
+        cacheStatErr = 0;
+    } else {
+        cacheStatErr = errno;
+    }
     kDebug(KIO_SMB) << "size " << (KIO::filesize_t)st->st_size;
-    return result;
+    return cacheStatErr;
 }
 
 //---------------------------------------------------------------------------
 bool SMBSlave::browse_stat_path(const SMBUrl& _url, UDSEntry& udsentry, bool ignore_errors)
   // Returns: true on success, false on failure
 {
-    SMBUrl url = _url;
+   SMBUrl url = _url;
 
-   if(cache_stat(url, &st) == 0)
+   int cacheStatErr = cache_stat(url, &st);
+   if(cacheStatErr == 0)
    {
       if(!S_ISDIR(st.st_mode) && !S_ISREG(st.st_mode))
       {
@@ -94,14 +100,14 @@
    else
    {
        if (!ignore_errors) {
-           if (errno == EPERM || errno == EACCES)
+           if (cacheStatErr == EPERM || cacheStatErr == EACCES)
                if (checkPassword(url)) {
                    redirection( url );
                    return false;
                }
 
-           reportError(url);
-       } else if (errno == ENOENT || errno == ENOTDIR) {
+           reportError(url, cacheStatErr);
+       } else if (cacheStatErr == ENOENT || cacheStatErr == ENOTDIR) {
            warning(i18n("File does not exist: %1", url.url()));
        }
        kDebug(KIO_SMB) << "SMBSlave::browse_stat_path ERROR!!";
@@ -206,10 +212,11 @@
     return url;
 }
 
-void SMBSlave::reportError(const SMBUrl &url)
+void SMBSlave::reportError(const SMBUrl &url, const int &errNum)
 {
-    kDebug(KIO_SMB) << "reportError " << url << " " << perror;
-    switch(errno)
+    kDebug(KIO_SMB) << "errNum" << errNum;
+
+    switch(errNum)
     {
     case ENOENT:
         if (url.getType() == SMBURLTYPE_ENTIRE_NETWORK)
@@ -279,7 +286,7 @@
 								"if they ask for it)") );
 	  break;
     default:
-        error( ERR_INTERNAL, i18n("Unknown error condition in stat: %1", QString::fromLocal8Bit( strerror(errno))) );
+        error( ERR_INTERNAL, i18n("Unknown error condition in stat: %1", QString::fromLocal8Bit( strerror(errNum))) );
     }
 }
 
@@ -287,6 +294,7 @@
 void SMBSlave::listDir( const KUrl& kurl )
 {
    kDebug(KIO_SMB) << "SMBSlave::listDir on " << kurl;
+   int errNum = 0;
 
    // check (correct) URL
    KUrl url = checkURL(kurl);
@@ -305,6 +313,12 @@
    UDSEntry    udsentry;
 
    dirfd = smbc_opendir( m_current_url.toSmbcUrl() );
+   if (dirfd > 0){
+      errNum = 0;
+   } else {
+      errNum = errno;
+   }
+
    kDebug(KIO_SMB) << "SMBSlave::listDir open " << m_current_url.toSmbcUrl() << " " << m_current_url.getType() << " " << dirfd;
    if(dirfd >= 0)
    {
@@ -416,14 +430,15 @@
    }
    else
    {
-       if (errno == EPERM || errno == EACCES)
+       if (errNum == EPERM || errNum == EACCES) {
            if (checkPassword(m_current_url)) {
                redirection( m_current_url );
                finished();
                return;
            }
+       }
 
-       reportError(m_current_url);
+       reportError(m_current_url, errNum);
        finished();
        return;
    }
Index: runtime/kioslave/smb/kio_smb_auth.cpp
===================================================================
--- runtime/kioslave/smb/kio_smb_auth.cpp	(revision 804348)
+++ runtime/kioslave/smb/kio_smb_auth.cpp	(working copy)
@@ -47,6 +47,7 @@
 //==========================================================================
 {
     if (context != NULL) {
+        // FIXME deprecated use smbc_getOption*() functions instead
         SMBSlave *theSlave = (SMBSlave*)smbc_option_get(context, "user_data");
         theSlave->auth_smbc_get_data(server, share,
                                      workgroup,wgmaxlen,
@@ -188,11 +189,12 @@
 
 	smb_context->debug = debug_level;
 	smb_context->callbacks.auth_fn = NULL;
+    // FIXME deprecated use smbc_setOption*() functions instead.
 	smbc_option_set(smb_context, "auth_function", (void*)::auth_smbc_get_data);
 	smbc_option_set(smb_context, "user_data", this);
 
 	if (!smbc_init_context(smb_context)) {
-		smbc_free_context(smb_context, false);
+		smbc_free_context(smb_context, 0);
 		smb_context = NULL;
             	SlaveBase::error(ERR_INTERNAL, i18n("libsmbclient failed to initialize context"));
 	    	return false;
Index: runtime/kioslave/smb/kio_smb_dir.cpp
===================================================================
--- runtime/kioslave/smb/kio_smb_dir.cpp	(revision 804348)
+++ runtime/kioslave/smb/kio_smb_dir.cpp	(working copy)
@@ -44,10 +44,11 @@
     SMBUrl          src;
     SMBUrl          dst;
     mode_t          initialmode;
-    int             n;
+    ssize_t         n;
     int             dstflags;
     int             srcfd = -1;
     int             dstfd = -1;
+    int             errNum = 0;
     KIO::filesize_t processed_size = 0;
     unsigned char   buf[MAX_XFER_BUF_SIZE];
 
@@ -58,9 +59,10 @@
     dst = kdst;
 
     // Obtain information about source
-    if(cache_stat(src, &st ) == -1)
+    errNum = cache_stat(src, &st );
+    if( errNum != 0 )
     {
-        if ( errno == EACCES )
+        if ( errNum == EACCES )
         {
             error( KIO::ERR_ACCESS_DENIED, src.prettyUrl());
         }
@@ -78,7 +80,8 @@
     totalSize(st.st_size);
 
     // Check to se if the destination exists
-    if(cache_stat(dst, &st) != -1)
+    errNum = cache_stat(dst, &st);
+    if( errNum == 0 )
     {
         if(S_ISDIR(st.st_mode))
         {
@@ -94,9 +97,15 @@
 
     // Open the source file
     srcfd = smbc_open(src.toSmbcUrl(), O_RDONLY, 0);
+    if (srcfd < 0){
+        errNum = errno;
+    } else {
+        errNum = 0;
+    }
+
     if(srcfd < 0)
     {
-        if(errno == EACCES)
+        if(errNum == EACCES)
         {
             error( KIO::ERR_ACCESS_DENIED, src.prettyUrl() );
         }
@@ -125,9 +134,15 @@
         dstflags |= O_EXCL;
     }
     dstfd = smbc_open(dst.toSmbcUrl(), dstflags, initialmode);
+    if (dstfd < 0){
+        errNum = errno;
+    } else {
+        errNum = 0;
+    }
+
     if(dstfd < 0)
     {
-        if(errno == EACCES)
+        if(errNum == EACCES)
         {
             error(KIO::ERR_WRITE_ACCESS_DENIED, dst.prettyUrl());
         }
@@ -135,10 +150,11 @@
         {
             error(KIO::ERR_CANNOT_OPEN_FOR_READING, dst.prettyUrl());
         }
-	if(srcfd >= 0 )
-	{
-	  smbc_close(srcfd);
-	}
+
+        if(srcfd >= 0 )
+        {
+            smbc_close(srcfd);
+        }
         return;
     }
 
@@ -201,30 +217,39 @@
 {
     kDebug(KIO_SMB) << "SMBSlave::del on " << kurl;
     m_current_url = kurl;
+    int errNum = 0;
+    int retVal = 0;
 
     if(isfile)
     {
         // Delete file
         kDebug(KIO_SMB) << "SMBSlave:: unlink " << kurl;
-        if(smbc_unlink(m_current_url.toSmbcUrl()) == -1)
+        retVal = smbc_unlink(m_current_url.toSmbcUrl());
+        if ( retVal < 0 ){
+            errNum = errno;
+        } else {
+            errNum = 0;
+        }
+
+        if( retVal < 0 )
         {
-            switch(errno)
-            {
-            case EISDIR:
-                error( KIO::ERR_IS_DIRECTORY, m_current_url.prettyUrl());
-                break;
-            default:
-                reportError(kurl);
-            }
+            reportError(kurl, errNum);
         }
     }
     else
     {
         kDebug(KIO_SMB) << "SMBSlave:: rmdir " << kurl;
         // Delete directory
-        if(smbc_rmdir(m_current_url.toSmbcUrl()) == -1)
+        retVal = smbc_rmdir(m_current_url.toSmbcUrl());
+        if( retVal < 0 ) {
+            errNum = errno;
+        } else {
+            errNum = 0;
+        }
+
+        if( retVal < 0 )
         {
-            reportError(kurl);
+            reportError(kurl, errNum);
         }
     }
 
@@ -235,12 +260,22 @@
 void SMBSlave::mkdir( const KUrl &kurl, int permissions )
 {
     kDebug(KIO_SMB) << "SMBSlave::mkdir on " << kurl;
+    int errNum = 0;
+    int retVal = 0;
     m_current_url = kurl;
 
-    if(smbc_mkdir(m_current_url.toSmbcUrl(), 0777) != 0)
+    retVal = smbc_mkdir(m_current_url.toSmbcUrl(), 0777);
+    if( retVal < 0 ){
+        errNum = errno;
+    } else {
+        errNum = 0;
+    }
+
+    if( retVal < 0 )
     {
-        if (errno == EEXIST) {
-            if(cache_stat(m_current_url, &st ) == 0)
+        if (errNum == EEXIST) {
+            errNum = cache_stat(m_current_url, &st );
+            if( errNum == 0 )
             {
                 if(S_ISDIR(st.st_mode ))
                 {
@@ -252,7 +287,7 @@
                 error( KIO::ERR_FILE_ALREADY_EXIST, m_current_url.prettyUrl());
             }
         } else
-            reportError(kurl);
+            reportError(kurl, errNum);
 	kDebug(KIO_SMB) << "SMBSlave::mkdir exit with error " << kurl;
     }
     else
@@ -274,6 +309,8 @@
 
     SMBUrl      src;
     SMBUrl      dst;
+    int         errNum = 0;
+    int         retVal = 0;
 
     kDebug(KIO_SMB) << "SMBSlave::rename, old name = " << ksrc << ", new name = " << kdest;
 
@@ -283,7 +320,8 @@
     // Check to se if the destination exists
 
     kDebug(KIO_SMB) << "SMBSlave::rename stat dst";
-    if(cache_stat(dst, &st) != -1)
+    errNum = cache_stat(dst, &st);
+    if( errNum == 0 )
     {
         if(S_ISDIR(st.st_mode))
         {
@@ -301,15 +339,23 @@
 	}
     }
     kDebug(KIO_SMB ) << "smbc_rename " << src.toSmbcUrl() << " " << dst.toSmbcUrl();
-    if(smbc_rename(src.toSmbcUrl(), dst.toSmbcUrl())!=0)
+    retVal = smbc_rename(src.toSmbcUrl(), dst.toSmbcUrl());
+    if( retVal < 0 ){
+        errNum = errno;
+    } else {
+        errNum = 0;
+    }
+
+    if( retVal < 0 )
     {
-        kDebug(KIO_SMB ) << "failed " << perror;
-      switch(errno)
+      kDebug(KIO_SMB ) << "failed ";
+      switch(errNum)
       {
         case ENOENT:
-          if(cache_stat(src, &st) == -1)
+          errNum = cache_stat(src, &st);
+          if( errNum != 0 )
           {
-              if(errno == EACCES)
+              if(errNum == EACCES)
 	      {
 	        kDebug(KIO_SMB) << "SMBSlave::rename KIO::ERR_ACCESS_DENIED";
                 error(KIO::ERR_ACCESS_DENIED, src.prettyUrl());
Index: runtime/kioslave/smb/kio_smb_file.cpp
===================================================================
--- runtime/kioslave/smb/kio_smb_file.cpp	(revision 804348)
+++ runtime/kioslave/smb/kio_smb_file.cpp	(working copy)
@@ -42,6 +42,7 @@
 {
     char        buf[MAX_XFER_BUF_SIZE];
     int         filefd          = 0;
+    int         errNum          = 0;
     ssize_t     bytesread       = 0;
     // time_t      curtime         = 0;
     time_t      lasttime        = 0;
@@ -66,9 +67,10 @@
 
     // Stat
     url = kurl;
-    if(cache_stat(url,&st) == -1 )
+    errNum = cache_stat(url,&st);
+    if( errNum != 0 )
     {
-        if ( errno == EACCES )
+        if ( errNum == EACCES )
            error( KIO::ERR_ACCESS_DENIED, url.prettyUrl());
         else
            error( KIO::ERR_DOES_NOT_EXIST, url.prettyUrl());
@@ -134,14 +136,14 @@
 
 
 //===========================================================================
-void SMBSlave::open( const KUrl& kurl, QIODevice::OpenMode /*mode*/)
+void SMBSlave::open( const KUrl& kurl, QIODevice::OpenMode mode)
 {
-    SMBUrl      url;
-
+    int           errNum = 0;
     kDebug(KIO_SMB) << "SMBSlave::open on " << kurl;
 
     // check (correct) URL
     KUrl kvurl = checkURL(kurl);
+
     // if URL is not valid we have to redirect to correct URL
     if (kvurl != kurl) {
         redirection(kvurl);
@@ -149,102 +151,152 @@
         return;
     }
 
-    if(!auth_initialize_smbc())
+    if(!auth_initialize_smbc()) {
+        error( KIO::ERR_ACCESS_DENIED, kurl.prettyUrl());
         return;
+    }
 
+    // Save the URL as a private member
+    // FIXME For some reason m_openUrl has be be declared in bottom private
+    // section of the class SMBSlave declaratiom instead of the top section
+    // or else this assignment fails
+    m_openUrl = kurl;
+
     // Stat
-    url = kurl;
-    if(cache_stat(url,&st) == -1 )
+    errNum = cache_stat(m_openUrl,&st);
+    if( errNum != 0 )
     {
-        if ( errno == EACCES )
-           error( KIO::ERR_ACCESS_DENIED, url.prettyUrl());
+        if ( errNum == EACCES )
+            error( KIO::ERR_ACCESS_DENIED, m_openUrl.prettyUrl());
         else
-           error( KIO::ERR_DOES_NOT_EXIST, url.prettyUrl());
+            error( KIO::ERR_DOES_NOT_EXIST, m_openUrl.prettyUrl());
         return;
     }
     if ( S_ISDIR( st.st_mode ) ) {
-        error( KIO::ERR_IS_DIRECTORY, url.prettyUrl());
+        error( KIO::ERR_IS_DIRECTORY, m_openUrl.prettyUrl());
         return;
     }
 
     // Set the total size
     totalSize( st.st_size );
 
-    // Open and read the file
-    openFd = smbc_open(url.toSmbcUrl(),O_RDONLY,0);
-    if(openFd < 0)
+    // Convert permissions
+    int flags = 0;
+    if (mode & QIODevice::ReadOnly) {
+        if (mode & QIODevice::WriteOnly) {
+            flags = O_RDWR | O_CREAT;
+        } else {
+            flags = O_RDONLY;
+        }
+    } else if (mode & QIODevice::WriteOnly) {
+        flags = O_WRONLY | O_CREAT;
+    }
+
+    if (mode & QIODevice::Append) {
+        flags |= O_APPEND;
+    } else if (mode & QIODevice::Truncate) {
+        flags |= O_TRUNC;
+    }
+
+    // Open the file
+    m_openFd = smbc_open(m_openUrl.toSmbcUrl(), flags, 0);
+    if(m_openFd < 0)
     {
-        error( KIO::ERR_CANNOT_OPEN_FOR_READING, url.prettyUrl());
+        error( KIO::ERR_CANNOT_OPEN_FOR_READING, m_openUrl.prettyUrl());
         return;
     }
 
+    // Determine the mimetype of the file to be retrieved, and emit it.
+    // This is mandatory in all slaves (for KRun/BrowserRun to work).
+    // If we're not opening the file ReadOnly or ReadWrite, don't attempt to
+    // read the file and send the mimetype.
+    if (mode & QIODevice::ReadOnly){
+        ssize_t     bytesRequested  = 1024;
+        ssize_t     bytesRead       = 0;
+        QVarLengthArray<char> buffer(bytesRequested);
+        bytesRead = smbc_read(m_openFd, buffer.data(), bytesRequested);
+        if(bytesRead < 0)
+        {
+            error( KIO::ERR_COULD_NOT_READ, m_openUrl.prettyUrl());
+            close();
+            return;
+        }
+        else
+        {
+            QByteArray fileData = QByteArray::fromRawData(buffer.data(),bytesRead);
+            KMimeType::Ptr p_mimeType = KMimeType::findByNameAndContent(m_openUrl.fileName(), fileData);
+            mimeType(p_mimeType->name());
+
+            off_t res = smbc_lseek(m_openFd, 0, SEEK_SET);
+            if (res == (off_t)-1) {
+                error(KIO::ERR_COULD_NOT_SEEK, m_openUrl.path());
+                close();
+                return;
+            }
+        }
+    }
+
     position( 0 );
     emit opened();
-    openUrl = url;
-    justOpened = true;
 }
 
-void SMBSlave::read(KIO::filesize_t bytes)
+
+void SMBSlave::read( KIO::filesize_t bytesRequested )
 {
-    kDebug( KIO_SMB ) << "open -- read";
-    Q_ASSERT(openFd != -1);
+    Q_ASSERT(m_openFd != -1);
 
-    QVarLengthArray<char> buffer(bytes);
-    ssize_t     bytesread       = 0;
-    // time_t      curtime         = 0;
-    time_t      lasttime        = 0;
-    time_t      starttime       = 0;
+    QVarLengthArray<char> buffer(bytesRequested);
+    ssize_t     bytesRead       = 0;
 
-    lasttime = starttime = time(NULL);
-    bytesread = smbc_read(openFd, buffer.data(), bytes);
-    if(bytesread == 0)
+    bytesRead = smbc_read(m_openFd, buffer.data(), bytesRequested);
+    Q_ASSERT(bytesRead <= static_cast<ssize_t>(bytesRequested));
+
+    if(bytesRead < 0)
     {
-        // All done reading
-        data(QByteArray());
-    }
-    else if(bytesread < 0)
-    {
-        error( KIO::ERR_COULD_NOT_READ, openUrl.prettyUrl());
+        kDebug(KIO_SMB) << "Could not read " << m_openUrl;
+        error( KIO::ERR_COULD_NOT_READ, m_openUrl.prettyUrl());
         close();
         return;
     }
-    else
-    {
-        QByteArray filedata = QByteArray::fromRawData(buffer.data(),bytesread);
-        if (justOpened)
-        {
-            KMimeType::Ptr p_mimeType = KMimeType::findByNameAndContent(openUrl.fileName(), filedata);
-            mimeType(p_mimeType->name());
-            justOpened = false;
-        }
-        data( filedata );
-        filedata.clear();
-    }
+
+    QByteArray fileData = QByteArray::fromRawData(buffer.data(), bytesRead);
+    data( fileData );
 }
 
-void SMBSlave::write(const QByteArray &data)
+
+void SMBSlave::write(const QByteArray &fileData)
 {
-    kDebug( KIO_SMB ) << "open -- write";
+    Q_ASSERT(m_openFd != -1);
 
-    // not implemented
-    KIO::SlaveBase::write(data);
+    QByteArray buf(fileData);
+
+    ssize_t size = smbc_write(m_openFd, buf.data(), buf.size());
+    if (size < 0)
+    {
+        kDebug(KIO_SMB) << "Could not write to " << m_openUrl;
+        error( KIO::ERR_COULD_NOT_WRITE, m_openUrl.prettyUrl());
+        close();
+        return;
+    }
+
+    written(size);
 }
 
 void SMBSlave::seek(KIO::filesize_t offset)
 {
-    kDebug( KIO_SMB ) << "open -- seek";
-    int res = smbc_lseek(openFd, offset, SEEK_SET);
-    if (res != -1) {
-        position( offset );
+    off_t res = smbc_lseek(m_openFd, static_cast<off_t>(offset), SEEK_SET);
+    if (res == (off_t)-1) {
+        error(KIO::ERR_COULD_NOT_SEEK, m_openUrl.path());
+        close();
     } else {
-        error(KIO::ERR_COULD_NOT_SEEK, openUrl.path());
-        close();
+        kDebug( KIO_SMB ) << "res" << res;
+        position( res );
     }
 }
 
 void SMBSlave::close()
 {
-    smbc_close(openFd);
+    smbc_close(m_openFd);
     finished();
 }
 
@@ -261,13 +313,15 @@
 
     int         filefd;
     bool        exists;
+    int         errNum = 0;
+    off_t       retValLSeek = 0;
     mode_t      mode;
     QByteArray  filedata;
 
     kDebug(KIO_SMB) << "SMBSlave::put on " << kurl;
 
-
-    exists = (cache_stat(m_current_url, &st) != -1 );
+    errNum = cache_stat(m_current_url, &st);
+    exists = (errNum == 0);
     if ( exists &&  !(flags & KIO::Overwrite) && !(flags & KIO::Resume))
     {
         if (S_ISDIR(st.st_mode))
@@ -295,7 +349,18 @@
         // append if resuming
         kDebug(KIO_SMB) << "SMBSlave::put resume " << m_current_url.toSmbcUrl();
         filefd = smbc_open(m_current_url.toSmbcUrl(), O_RDWR, 0 );
-        smbc_lseek(filefd, 0, SEEK_END);
+        if (filefd < 0) {
+            errNum = errno;
+        } else {
+            errNum = 0;
+        }
+
+        retValLSeek = smbc_lseek(filefd, 0, SEEK_END);
+        if (retValLSeek == (off_t)-1) {
+            errNum = errno;
+        } else {
+            errNum = 0;
+        }
     }
     else
     {
@@ -310,11 +375,16 @@
 
         kDebug(KIO_SMB) << "SMBSlave::put NO resume " << m_current_url.toSmbcUrl();
         filefd = smbc_open(m_current_url.toSmbcUrl(), O_CREAT | O_TRUNC | O_WRONLY, mode);
+        if (filefd < 0) {
+            errNum = errno;
+        } else {
+            errNum = 0;
+        }
     }
 
     if ( filefd < 0 )
     {
-        if ( errno == EACCES )
+        if ( errNum == EACCES )
         {
             kDebug(KIO_SMB) << "SMBSlave::put error " << kurl <<" access denied !!";
             error( KIO::ERR_WRITE_ACCESS_DENIED, m_current_url.prettyUrl());
@@ -343,7 +413,7 @@
         kDebug(KIO_SMB) << "SMBSlave::put write " << m_current_url.toSmbcUrl();
 	buf = filedata.data();
 	bufsize = filedata.size();
-        int size = smbc_write(filefd, buf, bufsize);
+        ssize_t size = smbc_write(filefd, buf, bufsize);
         if ( size < 0)
         {
             kDebug(KIO_SMB) << "SMBSlave::put error " << kurl <<" could not write !!";
@@ -355,7 +425,7 @@
     }
     kDebug(KIO_SMB) << "SMBSlave::put close " << m_current_url.toSmbcUrl();
 
-    if(smbc_close(filefd))
+    if(smbc_close(filefd) < 0)
     {
         kDebug(KIO_SMB) << "SMBSlave::put on " << kurl <<" could not write !!";
         error( KIO::ERR_COULD_NOT_WRITE, m_current_url.prettyUrl());
Index: runtime/kioslave/smb/kio_smb.cpp
===================================================================
--- runtime/kioslave/smb/kio_smb.cpp	(revision 804348)
+++ runtime/kioslave/smb/kio_smb.cpp	(working copy)
@@ -34,7 +34,7 @@
 
 //===========================================================================
 SMBSlave::SMBSlave(const QByteArray& pool, const QByteArray& app)
-    : SlaveBase( "smb", pool, app ), openFd(-1)
+    : SlaveBase( "smb", pool, app ), m_openFd(-1)
 {
     m_initialized_smbc = false;
 
Index: runtime/kioslave/smb/kio_smb.h
===================================================================
--- runtime/kioslave/smb/kio_smb.h	(revision 804348)
+++ runtime/kioslave/smb/kio_smb.h	(working copy)
@@ -127,6 +127,7 @@
      * looks like gcc (C/C++) failure
      */
     struct stat st;
+
 protected:
     //---------------------------------------------
     // Authentication functions (kio_smb_auth.cpp)
@@ -214,7 +215,7 @@
      */
     KUrl checkURL(const KUrl& kurl) const;
 
-    void reportError(const SMBUrl &kurl);
+    void reportError(const SMBUrl &kurl, const int &errNum);
 
 public:
 
@@ -254,8 +255,8 @@
     virtual void get( const KUrl& kurl );
     virtual void put( const KUrl& kurl, int permissions, KIO::JobFlags flags );
     virtual void open( const KUrl& kurl, QIODevice::OpenMode mode );
-    virtual void read( KIO::filesize_t size );
-    virtual void write( const QByteArray &data );
+    virtual void read( KIO::filesize_t bytesRequested );
+    virtual void write( const QByteArray &fileData );
     virtual void seek( KIO::filesize_t offset );
     virtual void close();
 
@@ -272,10 +273,13 @@
 
 private:
     QString mybuf, mystderr;
-
-    int openFd;
-    bool justOpened;
-    SMBUrl openUrl;
+     /**
+     * Used in open(), read(), write(), and close()
+     * FIXME Placing these in the private section above causes m_openUrl = kurl
+     * to fail in SMBSlave::open. Need to find out why this is.
+     */
+    int m_openFd;
+    SMBUrl m_openUrl;
 };
 
 //==========================================================================
