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 878D6416467
\r
6 for <notmuch@notmuchmail.org>; Mon, 9 Apr 2012 03:18:45 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-2.299 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_MED=-2.3, 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 rBOA6stHhMgT for <notmuch@notmuchmail.org>;
\r
17 Mon, 9 Apr 2012 03:18:44 -0700 (PDT)
\r
18 Received: from rcsinet14.oracle.com (rcsinet14.oracle.com [148.87.113.126])
\r
19 (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
\r
20 (No client certificate requested)
\r
21 by olra.theworths.org (Postfix) with ESMTPS id 745E5416464
\r
22 for <notmuch@notmuchmail.org>; Mon, 9 Apr 2012 03:18:44 -0700 (PDT)
\r
23 Received: from rcsinet15.oracle.com (rcsinet15.oracle.com [148.87.113.117])
\r
24 by rcsinet14.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with
\r
25 ESMTP id q39AGbrP026349
\r
26 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK)
\r
27 for <notmuch@notmuchmail.org>; Mon, 9 Apr 2012 10:16:37 GMT
\r
28 Received: from ucsinet21.oracle.com (ucsinet21.oracle.com [156.151.31.93])
\r
29 by rcsinet15.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with
\r
30 ESMTP id q39AIfQn010126
\r
31 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
\r
32 Mon, 9 Apr 2012 10:18:42 GMT
\r
33 Received: from acsmt356.oracle.com (acsmt356.oracle.com [141.146.40.156])
\r
34 by ucsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id
\r
36 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
\r
37 Mon, 9 Apr 2012 10:18:41 GMT
\r
38 Received: from abhmt120.oracle.com (abhmt120.oracle.com [141.146.116.72])
\r
39 by acsmt356.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id
\r
40 q39AIeta008108; Mon, 9 Apr 2012 05:18:40 -0500
\r
41 Received: from pub.czech.sun.com (/10.163.20.32)
\r
42 by default (Oracle Beehive Gateway v4.0)
\r
43 with ESMTP ; Mon, 09 Apr 2012 03:18:40 -0700
\r
44 From: Vladimir.Marek@oracle.com
\r
45 To: notmuch@notmuchmail.org
\r
46 Subject: [PATCH 2/4] dirent->d_type not available on Soalris
\r
47 Date: Mon, 9 Apr 2012 12:17:43 +0200
\r
48 Message-Id: <1333966665-10469-3-git-send-email-Vladimir.Marek@oracle.com>
\r
49 X-Mailer: git-send-email 1.7.3.2
\r
50 In-Reply-To: <1333966665-10469-1-git-send-email-Vladimir.Marek@oracle.com>
\r
51 References: <1333966665-10469-1-git-send-email-Vladimir.Marek@oracle.com>
\r
52 X-Source-IP: ucsinet21.oracle.com [156.151.31.93]
\r
53 X-CT-RefId: str=0001.0A090201.4F82B782.00BB,ss=1,re=0.000,fgs=0
\r
54 Cc: Vladimir Marek <vlmarek@volny.cz>
\r
55 X-BeenThere: notmuch@notmuchmail.org
\r
56 X-Mailman-Version: 2.1.13
\r
58 List-Id: "Use and development of the notmuch mail system."
\r
59 <notmuch.notmuchmail.org>
\r
60 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
61 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
62 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
63 List-Post: <mailto:notmuch@notmuchmail.org>
\r
64 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
65 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
66 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
67 X-List-Received-Date: Mon, 09 Apr 2012 10:18:45 -0000
\r
69 From: Vladimir Marek <vlmarek@volny.cz>
\r
71 The inspiration was taken from similar issue in mutt:
\r
72 http://does-not-exist.org/mail-archives/mutt-dev/msg11290.html
\r
74 Signed-off-by: Vladimir Marek <vlmarek@volny.cz>
\r
76 notmuch-new.c | 19 +++++++++++++------
\r
77 1 files changed, 13 insertions(+), 6 deletions(-)
\r
79 diff --git a/notmuch-new.c b/notmuch-new.c
\r
80 index 4f13535..20bc580 100644
\r
84 #include "notmuch-client.h"
\r
87 +#include <sys/types.h>
\r
89 typedef struct _filename_node {
\r
91 @@ -165,9 +166,12 @@ static int
\r
92 _entries_resemble_maildir (struct dirent **entries, int count)
\r
95 + struct stat statbuf;
\r
97 for (i = 0; i < count; i++) {
\r
98 - if (entries[i]->d_type != DT_DIR && entries[i]->d_type != DT_UNKNOWN)
\r
99 + if (stat(entries[i]->d_name, &statbuf) == -1)
\r
101 + if (! S_ISDIR(statbuf.st_mode))
\r
104 if (strcmp(entries[i]->d_name, "new") == 0 ||
\r
105 @@ -258,6 +262,7 @@ add_files_recursive (notmuch_database_t *notmuch,
\r
107 notmuch_bool_t is_maildir, new_directory;
\r
109 + struct stat statbuf;
\r
111 if (stat (path, &st)) {
\r
112 fprintf (stderr, "Error reading directory %s: %s\n",
\r
113 @@ -321,6 +326,9 @@ add_files_recursive (notmuch_database_t *notmuch,
\r
115 entry = fs_entries[i];
\r
117 + if (stat(entry->d_name, &statbuf) == -1)
\r
120 /* We only want to descend into directories.
\r
121 * But symlinks can be to directories too, of course.
\r
123 @@ -328,9 +336,8 @@ add_files_recursive (notmuch_database_t *notmuch,
\r
124 * scandir results, then it might be a directory (and if not,
\r
125 * then we'll stat and return immediately in the next level of
\r
127 - if (entry->d_type != DT_DIR &&
\r
128 - entry->d_type != DT_LNK &&
\r
129 - entry->d_type != DT_UNKNOWN)
\r
130 + if (!(statbuf.st_mode & S_IFDIR) &&
\r
131 + !(statbuf.st_mode & S_IFLNK))
\r
135 @@ -427,7 +434,7 @@ add_files_recursive (notmuch_database_t *notmuch,
\r
137 * In either case, a stat does the trick.
\r
139 - if (entry->d_type == DT_LNK || entry->d_type == DT_UNKNOWN) {
\r
140 + if (stat(entry->d_name, &statbuf) == -1 || statbuf.st_mode & S_IFLNK) {
\r
143 next = talloc_asprintf (notmuch, "%s/%s", path, entry->d_name);
\r
144 @@ -443,7 +450,7 @@ add_files_recursive (notmuch_database_t *notmuch,
\r
146 if (! S_ISREG (st.st_mode))
\r
148 - } else if (entry->d_type != DT_REG) {
\r
149 + } else if ( statbuf.st_mode & S_IFREG) {
\r