Selaa lähdekoodia

smb_fseek should return -1 on error as zero is an acceptable seek position

Signed-off-by: Felix Paul Kühne <fkuehne@videolan.org>
Scott Davilla 9 vuotta sitten
vanhempi
commit
db36f54b10
2 muutettua tiedostoa jossa 2 lisäystä ja 2 poistoa
  1. 1 1
      include/bdsm/smb_file.h
  2. 1 1
      src/smb_file.c

+ 1 - 1
include/bdsm/smb_file.h

@@ -110,7 +110,7 @@ ssize_t   smb_fwrite(smb_session *s, smb_fd fd, void *buf, size_t buf_size);
  * @param offset Set/Adjust quantity
  * @param whence Which action to perform. Supported operations are
  * #SMB_SEEK_SET and #SMB_SEEK_CUR
- * @return The current read pointer position
+ * @return The current read pointer position or -1 on error
  */
 ssize_t   smb_fseek(smb_session *s, smb_fd fd, ssize_t offset, int whence);
 

+ 1 - 1
src/smb_file.c

@@ -287,7 +287,7 @@ ssize_t   smb_fseek(smb_session *s, smb_fd fd, ssize_t offset, int whence)
     assert(s != NULL);
 
     if (!fd || (file = smb_session_file_get(s, fd)) == NULL)
-        return 0;
+        return -1;
 
     if (whence == SMB_SEEK_SET)
         file->offset = offset;