mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Jörn Engel" <joern@wohnheim.fh-wedel.de>
To: jblunck@suse.de
Cc: linux-kernel@vger.kernel.org
Subject: Re: [RFC,PATCH] libfs dcache_readdir() and dcache_dir_lseek() bugfix
Date: Fri, 4 Nov 2005 13:52:21 +0100	[thread overview]
Message-ID: <20051104125221.GA18718@wohnheim.fh-wedel.de> (raw)
In-Reply-To: <20051104113851.GA4770@hasse.suse.de>

On Fri, 4 November 2005 12:38:51 +0100, jblunck@suse.de wrote:

> #include <stdio.h>
> #include <unistd.h>
> #include <dirent.h>
> 
> int main(int argc, char *argv[])
> {
> 	DIR *dir;
> 	struct dirent *entry;
> 	unsigned int offset;
> 
>         if (argc < 2) {
>                 printf("USAGE:  %s <directory>\n", argv[0]);
>                 return 1;
>         }
> 
> 	dir = opendir(argv[1]);
> 	if (!dir)
> 		return 1;
> 
> 	while((entry = readdir(dir)) != NULL) {
> 		seekdir(dir, entry->d_off);
> 		printf("name=%s\tino=%d off=%d\n", entry->d_name, entry->d_ino,
> 		       entry->d_off);
> 		if (*entry->d_name == '.')
> 			continue;

That catches "." and "..", but also ".foo".  Doesn't matter for the
test, just wanted to mention it.

> 		if(unlink(entry->d_name) != 0)
> 			break;
> 	}
> 
> 	closedir(dir);
> 	return 0;
> }


Jörn

-- 
With a PC, I always felt limited by the software available. On Unix, 
I am limited only by my knowledge.
-- Peter J. Schoenster

      parent reply	other threads:[~2005-11-04 12:52 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-04 11:38 jblunck
2005-11-04 11:51 ` Al Viro
2005-11-04 12:20   ` jblunck
2005-11-04 12:56     ` Miklos Szeredi
2005-11-04 13:18       ` jblunck
2005-11-04 13:31         ` Miklos Szeredi
2005-11-04 15:11           ` jblunck
2005-11-04 15:16             ` Jörn Engel
2005-11-04 15:34               ` jblunck
2005-11-04 15:45                 ` Jörn Engel
2005-11-04 15:38               ` Miklos Szeredi
2005-11-04 15:32             ` Miklos Szeredi
2005-11-04 15:46               ` jblunck
2005-11-04 15:55                 ` Miklos Szeredi
2005-11-04 16:04                   ` jblunck
2005-11-04 16:19                     ` Miklos Szeredi
2005-11-07 10:17                       ` jblunck
2005-11-04 16:27                     ` Al Viro
2005-11-04 16:27             ` Trond Myklebust
2005-11-04 16:39               ` Miklos Szeredi
2005-11-04 16:55   ` Rob Landley
2005-11-07 10:06     ` jblunck
2005-11-04 12:52 ` Jörn Engel [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20051104125221.GA18718@wohnheim.fh-wedel.de \
    --to=joern@wohnheim.fh-wedel.de \
    --cc=jblunck@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®