b9874d0941
Add redbear-usb-storage-check in-guest binary that validates USB mass storage read and write I/O: discovers /scheme/disk/ devices, writes a test pattern to sector 2048, reads it back, verifies match, restores original content. Updates test-usb-storage-qemu.sh with write-proof verification step. Includes all accumulated Red Bear OS work: kernel patches, relibc patches, driver infrastructure, DRM/GPU, KDE recipes, firmware, validation tooling, build system hardening, and documentation.
28 lines
634 B
C
28 lines
634 B
C
#include <limits.h>
|
|
#include <unistd.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
#include "test_helpers.h"
|
|
|
|
int main(void) {
|
|
char cwd[PATH_MAX] = { 0 };
|
|
char *cwd_result = NULL;
|
|
|
|
cwd_result = getcwd(cwd, PATH_MAX);
|
|
ERROR_IF(getcwd, cwd_result, == NULL);
|
|
UNEXP_IF(getcwd, cwd_result, != cwd);
|
|
|
|
printf("getcwd before chdir: %s\n", cwd);
|
|
|
|
int status = chdir("..");
|
|
ERROR_IF(chdir, status, == -1);
|
|
UNEXP_IF(chdir, status, != 0);
|
|
|
|
cwd_result = getcwd(cwd, PATH_MAX);
|
|
ERROR_IF(getcwd, cwd_result, == NULL);
|
|
UNEXP_IF(getcwd, cwd_result, != cwd);
|
|
|
|
printf("getcwd after chdir: %s\n", cwd);
|
|
}
|