1 Return-Path: <Vladimir.Marek@oracle.com>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id CFC2A414B9A
\r
6 for <notmuch@notmuchmail.org>; Mon, 9 Apr 2012 09:32:49 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-4.999 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_HI=-5, UNPARSEABLE_RELAY=0.001]
\r
14 Received: from olra.theworths.org ([127.0.0.1])
\r
15 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
16 with ESMTP id wdaL3BgPyLhz for <notmuch@notmuchmail.org>;
\r
17 Mon, 9 Apr 2012 09:32:48 -0700 (PDT)
\r
18 X-Greylist: delayed 22445 seconds by postgrey-1.32 at olra;
\r
19 Mon, 09 Apr 2012 09:32:48 PDT
\r
20 Received: from rcsinet15.oracle.com (rcsinet15.oracle.com [148.87.113.117])
\r
21 (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
\r
22 (No client certificate requested)
\r
23 by olra.theworths.org (Postfix) with ESMTPS id D188C414B96
\r
24 for <notmuch@notmuchmail.org>; Mon, 9 Apr 2012 09:32:48 -0700 (PDT)
\r
25 Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238])
\r
26 by rcsinet15.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with
\r
27 ESMTP id q39GWkbT015218
\r
28 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
\r
29 Mon, 9 Apr 2012 16:32:47 GMT
\r
30 Received: from acsmt358.oracle.com (acsmt358.oracle.com [141.146.40.158])
\r
31 by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id
\r
33 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
\r
34 Mon, 9 Apr 2012 16:32:45 GMT
\r
35 Received: from abhmt106.oracle.com (abhmt106.oracle.com [141.146.116.58])
\r
36 by acsmt358.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id
\r
37 q39GWiHW028104; Mon, 9 Apr 2012 11:32:44 -0500
\r
38 Received: from pub.czech.sun.com (/10.163.20.32)
\r
39 by default (Oracle Beehive Gateway v4.0)
\r
40 with ESMTP ; Mon, 09 Apr 2012 09:32:44 -0700
\r
41 From: Vladimir.Marek@oracle.com
\r
42 To: notmuch@notmuchmail.org
\r
43 Subject: [PATCH 2/4] dirent->d_type not available on Soalris
\r
44 Date: Mon, 9 Apr 2012 18:32:07 +0200
\r
45 Message-Id: <1333989127-21523-1-git-send-email-Vladimir.Marek@oracle.com>
\r
46 X-Mailer: git-send-email 1.7.3.2
\r
48 <CAMoJFUvHbSfXLTGKf2ZZnaLpLzZiHJ7W_ZUYZzm70n5mw4r1Kg@mail.gmail.com>
\r
50 <CAMoJFUvHbSfXLTGKf2ZZnaLpLzZiHJ7W_ZUYZzm70n5mw4r1Kg@mail.gmail.com>
\r
51 X-Source-IP: acsinet22.oracle.com [141.146.126.238]
\r
52 X-CT-RefId: str=0001.0A090203.4F830F30.0012,ss=1,re=0.000,fgs=0
\r
53 Cc: Vladimir Marek <vlmarek@volny.cz>
\r
54 X-BeenThere: notmuch@notmuchmail.org
\r
55 X-Mailman-Version: 2.1.13
\r
57 List-Id: "Use and development of the notmuch mail system."
\r
58 <notmuch.notmuchmail.org>
\r
59 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
60 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
61 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
62 List-Post: <mailto:notmuch@notmuchmail.org>
\r
63 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
64 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
65 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
66 X-List-Received-Date: Mon, 09 Apr 2012 16:32:50 -0000
\r
68 From: Vladimir Marek <vlmarek@volny.cz>
\r
70 The inspiration was taken from similar issue in mutt:
\r
71 http://does-not-exist.org/mail-archives/mutt-dev/msg11290.html
\r
73 Signed-off-by: Vladimir Marek <vlmarek@volny.cz>
\r
75 notmuch-new.c | 28 ++++++++++++++++++++++++++++
\r
76 1 files changed, 28 insertions(+), 0 deletions(-)
\r
78 diff --git a/notmuch-new.c b/notmuch-new.c
\r
79 index 4f13535..3d265bd 100644
\r
83 #include "notmuch-client.h"
\r
86 +#ifndef _DIRENT_HAVE_D_TYPE
\r
87 +#include <sys/types.h>
\r
90 typedef struct _filename_node {
\r
92 @@ -167,7 +170,14 @@ _entries_resemble_maildir (struct dirent **entries, int count)
\r
95 for (i = 0; i < count; i++) {
\r
96 +#ifdef _DIRENT_HAVE_D_TYPE
\r
97 if (entries[i]->d_type != DT_DIR && entries[i]->d_type != DT_UNKNOWN)
\r
99 + struct stat statbuf;
\r
100 + if (stat(entries[i]->d_name, &statbuf) == -1)
\r
102 + if (! S_ISDIR(statbuf.st_mode))
\r
106 if (strcmp(entries[i]->d_name, "new") == 0 ||
\r
107 @@ -258,6 +268,9 @@ add_files_recursive (notmuch_database_t *notmuch,
\r
109 notmuch_bool_t is_maildir, new_directory;
\r
111 +#ifndef _DIRENT_HAVE_D_TYPE
\r
112 + struct stat statbuf;
\r
115 if (stat (path, &st)) {
\r
116 fprintf (stderr, "Error reading directory %s: %s\n",
\r
117 @@ -328,9 +341,16 @@ add_files_recursive (notmuch_database_t *notmuch,
\r
118 * scandir results, then it might be a directory (and if not,
\r
119 * then we'll stat and return immediately in the next level of
\r
121 +#ifdef _DIRENT_HAVE_D_TYPE
\r
122 if (entry->d_type != DT_DIR &&
\r
123 entry->d_type != DT_LNK &&
\r
124 entry->d_type != DT_UNKNOWN)
\r
126 + if (stat(entry->d_name, &statbuf) == -1)
\r
128 + if (!(statbuf.st_mode & S_IFDIR) &&
\r
129 + !(statbuf.st_mode & S_IFLNK))
\r
134 @@ -427,7 +447,11 @@ add_files_recursive (notmuch_database_t *notmuch,
\r
136 * In either case, a stat does the trick.
\r
138 +#ifdef _DIRENT_HAVE_D_TYPE
\r
139 if (entry->d_type == DT_LNK || entry->d_type == DT_UNKNOWN) {
\r
141 + if (stat(entry->d_name, &statbuf) == -1 || statbuf.st_mode & S_IFLNK) {
\r
145 next = talloc_asprintf (notmuch, "%s/%s", path, entry->d_name);
\r
146 @@ -443,7 +467,11 @@ add_files_recursive (notmuch_database_t *notmuch,
\r
148 if (! S_ISREG (st.st_mode))
\r
150 +#ifdef _DIRENT_HAVE_D_TYPE
\r
151 } else if (entry->d_type != DT_REG) {
\r
153 + } else if (statbuf.st_mode & S_IFREG) {
\r