Skip to content

filesystem api fails for virtual file systems #242

@Souvlaki42

Description

@Souvlaki42

Just try nob_read_entire_file() on something like /proc/meminfo to reproduce this.

#define NOB_IMPLEMENTATION
#include "nob.h"

int main(void) {
  String_Builder sb = {0};
  if (!read_entire_file("/proc/meminfo", &sb))
    return 1;
  return 0;
}

This makes sense because virtual file systems like procfs are generated on the fly, without a size that fseek() expects to read so it can pass it to fread().

It may fail in other cases but I'm not entirely sure.

My point is, I think nob should be able to handle these types of files, or at least fail with a descriptive message explaining the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions