From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qk1-x734.google.com (mail-qk1-x734.google.com [IPv6:2607:f8b0:4864:20::734]) by sourceware.org (Postfix) with ESMTPS id BB08B3840006 for ; Thu, 17 Jun 2021 02:39:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BB08B3840006 Received: by mail-qk1-x734.google.com with SMTP id q16so1648905qkm.9 for ; Wed, 16 Jun 2021 19:39:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=fqQ8vp9M71kHoHI1ws7GKb+TB9zxXGIQXu+ZNy7GpJU=; b=T/yjEwQdD0NK44bgQjqmzfHxXyss2VGUjoPqRSgdyQNkyeSn+yDYNqV390X5w2SfPS GoHcMW8pNqrQLFEE8AEwIquGTiaIdcxz+o/vvgwTOcTKqcr/bEAjqoJcwsgv0XkMVNSB HtdrNKGIipKLQzs2pcyYUou5YKNV4nEnumPnF4NJdkvgREJCcLFX/Op6lQ4s07KwU5gL eGvQed+s6GG2El2SCph0NuDVsKDeHqCLwsIyFpMB0PEwUAlJB2Qpt/VsYITW6UKydGqj 4Kk/NmrUd7cje5PEMs2fexOcjmCtdR8hLjLDxacThgY9tbP1YLCX0kGzbMAtyLtx5QUd WcWQ== X-Gm-Message-State: AOAM533Ujv15IQHcPrkHI3ZcgxznyY8lRJMp7PSmmNW9vuxv8IAPkohN osSk/78xHFRTfCLmsh+cATUO2tiBFVL0m/qz7i59Dxo/L98K7Q== X-Google-Smtp-Source: ABdhPJw6juvkGYFYp4E+uq8A4853xXfPL4OX+HPmfGaZPF6+Vvqe/1pvVwcczO3by1WXqAm/ex4ZpUI9gSmU2JPiuwQ= X-Received: by 2002:a05:620a:15b0:: with SMTP id f16mr1502533qkk.258.1623897543184; Wed, 16 Jun 2021 19:39:03 -0700 (PDT) MIME-Version: 1.0 From: flint pyrite Date: Wed, 16 Jun 2021 20:38:42 -0600 Message-ID: Subject: readdir and ENOENT error or EOF? To: libc-help@sourceware.org X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: libc-help@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-help mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Jun 2021 02:39:04 -0000 There appears to be ambiguity in user documentation for readdir when it returns NULL and errno is set to ENOENT. Is this an EOF condition or an actual error that should be handled? ... /* On some systems getdents fails with ENOENT when the open directory has been rmdir'd already. POSIX.1 requires that we treat this condition like normal EOF. */ if (bytes < 0 && errno == ENOENT) bytes = 0; ... https://code.woboq.org/userspace/glibc/sysdeps/posix/readdir.c.htmlin Thanks in advance for your time and help on this matter.