Displaying 5 results from an estimated 5 matches for "visit_subdirectory".
2018 Oct 30
1
Re: [PATCH nbdkit 4/4] Add floppy plugin.
...}
However, errno is undefined if lstat() succeeds. If it fails, you don't
call readdir() again; but if it succeeds, you cannot rely on libc having
left errno == 0.
>>> +
>>> + /* Directory. */
>>> + if (S_ISDIR (statbuf.st_mode)) {
>>> + if (visit_subdirectory (dir, d->d_name, &statbuf, di, floppy) == -1)
>>> + goto error2;
>>> + }
And then you have to audit whether your visit_subdirectory() code left
errno unchanged...
>>> + /* Regular file. */
>>> + else if (S_ISREG (statbuf.st_mode)) {
>...
2018 Oct 30
2
Re: [PATCH nbdkit 4/4] Add floppy plugin.
...) == 0)
> + continue;
> +
> + if (lstat (d->d_name, &statbuf) == -1) {
> + nbdkit_error ("stat: %s/%s: %m", dir, d->d_name);
> + goto error2;
> + }
> +
> + /* Directory. */
> + if (S_ISDIR (statbuf.st_mode)) {
> + if (visit_subdirectory (dir, d->d_name, &statbuf, di, floppy) == -1)
> + goto error2;
> + }
> + /* Regular file. */
> + else if (S_ISREG (statbuf.st_mode)) {
> + if (visit_file (dir, d->d_name, &statbuf, di, floppy) == -1)
> + goto error2;
> + }
> +...
2018 Oct 30
0
Re: [PATCH nbdkit 4/4] Add floppy plugin.
...gt;+
> >+ if (lstat (d->d_name, &statbuf) == -1) {
> >+ nbdkit_error ("stat: %s/%s: %m", dir, d->d_name);
> >+ goto error2;
> >+ }
> >+
> >+ /* Directory. */
> >+ if (S_ISDIR (statbuf.st_mode)) {
> >+ if (visit_subdirectory (dir, d->d_name, &statbuf, di, floppy) == -1)
> >+ goto error2;
> >+ }
> >+ /* Regular file. */
> >+ else if (S_ISREG (statbuf.st_mode)) {
> >+ if (visit_file (dir, d->d_name, &statbuf, di, floppy) == -1)
> >+ goto error2...
2018 Oct 28
6
[PATCH nbdkit 0/4] Add floppy plugin.
Add nbdkit-floppy-plugin, “inspired” by qemu's VVFAT driver, but
without the ability to handle writes.
The implementation is pretty complete, supporting FAT32, LFNs, volume
labels, timestamps, etc, and it passes both ‘make check’ and ‘make
check-valgrind’.
Usage is simple; to serve the current directory:
$ nbdkit floppy .
Then using guestfish (or any NBD client):
$ guestfish --ro
2018 Oct 28
0
[PATCH nbdkit 4/4] Add floppy plugin.
..."rounding.h"
+
+#include "virtual-floppy.h"
+
+/* This is the Windows 98 OEM name, and some sites recommend using it
+ * for greatest compatibility.
+ */
+#define OEM_NAME "MSWIN4.1"
+
+static ssize_t visit (const char *dir, struct virtual_floppy *floppy);
+static int visit_subdirectory (const char *dir, const char *name, const struct stat *statbuf, size_t di, struct virtual_floppy *floppy);
+static int visit_file (const char *dir, const char *name, const struct stat *statbuf, size_t di, struct virtual_floppy *floppy);
+static int create_mbr (struct virtual_floppy *floppy);
+stati...