Return-Path: X-Original-To: apmail-hadoop-hdfs-issues-archive@minotaur.apache.org Delivered-To: apmail-hadoop-hdfs-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B24A518D38 for ; Tue, 24 Nov 2015 19:50:11 +0000 (UTC) Received: (qmail 13161 invoked by uid 500); 24 Nov 2015 19:50:11 -0000 Delivered-To: apmail-hadoop-hdfs-issues-archive@hadoop.apache.org Received: (qmail 13083 invoked by uid 500); 24 Nov 2015 19:50:11 -0000 Mailing-List: contact hdfs-issues-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hdfs-issues@hadoop.apache.org Delivered-To: mailing list hdfs-issues@hadoop.apache.org Received: (qmail 13052 invoked by uid 99); 24 Nov 2015 19:50:11 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 24 Nov 2015 19:50:11 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 27D4D2C1F77 for ; Tue, 24 Nov 2015 19:50:11 +0000 (UTC) Date: Tue, 24 Nov 2015 19:50:11 +0000 (UTC) From: "Tsz Wo Nicholas Sze (JIRA)" To: hdfs-issues@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (HDFS-8407) hdfsListDirectory must set errno to 0 on success MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/HDFS-8407?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Tsz Wo Nicholas Sze updated HDFS-8407: -------------------------------------- Component/s: (was: HDFS) native > hdfsListDirectory must set errno to 0 on success > ------------------------------------------------ > > Key: HDFS-8407 > URL: https://issues.apache.org/jira/browse/HDFS-8407 > Project: Hadoop HDFS > Issue Type: Bug > Components: native > Reporter: Juan Yu > Assignee: Masatake Iwasaki > Fix For: 2.8.0 > > Attachments: HDFS-8407.001.patch, HDFS-8407.002.patch, HDFS-8407.003.patch > > > The documentation says it returns NULL on error, but it could also return NULL when the directory is empty. > /** > * hdfsListDirectory - Get list of files/directories for a given > * directory-path. hdfsFreeFileInfo should be called to deallocate memory. > * @param fs The configured filesystem handle. > * @param path The path of the directory. > * @param numEntries Set to the number of files/directories in path. > * @return Returns a dynamically-allocated array of hdfsFileInfo > * objects; NULL on error. > */ > {code} > hdfsFileInfo *pathList = NULL; > ... > //Figure out the number of entries in that directory > jPathListSize = (*env)->GetArrayLength(env, jPathList); > if (jPathListSize == 0) { > ret = 0; > goto done; > } > ... > if (ret) { > hdfsFreeFileInfo(pathList, jPathListSize); > errno = ret; > return NULL; > } > *numEntries = jPathListSize; > return pathList; > {code} > Either change the implementation to match the doc, or fix the doc to match the implementation. -- This message was sent by Atlassian JIRA (v6.3.4#6332)