From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-vs1-xe32.google.com (mail-vs1-xe32.google.com [IPv6:2607:f8b0:4864:20::e32]) by sourceware.org (Postfix) with ESMTPS id 65EB5397F408 for ; Wed, 16 Jun 2021 20:50:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 65EB5397F408 Received: by mail-vs1-xe32.google.com with SMTP id f21so1797041vsl.4 for ; Wed, 16 Jun 2021 13:50:02 -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=Ke22m4JlusyuTnohar1TqVA6Zl/FQT57GSIsjIziGyo=; b=LcSqJAj7lDe0TuiWTZP/7/LX/KsioNKO1xmzj+Jm2XP3Ch9zW97AW5hbch5eZo5DRy oOEynvZC1g8IK6WMbWwLZGEJV/bB7HKbcQK+s9St4wSzwOx6AQk2VIVCF8XeYBB/4gLb /BjM4G5KgYmrRnfIb+jU2V/uELCRxmM4Qa8Z2zYKf3yQqQs05oPG4xQy9jyZ31Mj4Fa4 4mD0LXTJiSiXy3TnER0/AMBj0nayIGHalGJQzkRvclwlHo3UkLpQT8NLn5xpBzz+3myL GsW0xuvyFCFe6koSWfSjPlTRDo70ugkeGpGugcXV0IO3zj2QvvbthhE5ciiY/Fb5Y2gu EFsg== X-Gm-Message-State: AOAM532IVEWl+p1eUbVZuZrBo6G1LWq6BDR9BY3COBZN2JyG8TDm1CUN /5j3ta13zNoMs48DQe8nWwWtDpuLdceqf5kf47DeZNOl9UDzSkhV X-Google-Smtp-Source: ABdhPJzzhiGtayhmJFf32+oueHAGmI5ZNqpUOewE2thpMtbhh8AfXxS6w0L3vnYOyWWeKAtJf7j9ceiWcpI7AZaHXZI= X-Received: by 2002:a67:b70b:: with SMTP id h11mr1364039vsf.57.1623876601717; Wed, 16 Jun 2021 13:50:01 -0700 (PDT) MIME-Version: 1.0 From: Mark Olesen Date: Wed, 16 Jun 2021 14:49:41 -0600 Message-ID: Subject: readdir and ENOENT error or EOF? To: libc-alpha@sourceware.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, 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 X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Jun 2021 20:50:05 -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.