cmogstored.git  about / heads / tags
alternative mogstored implementation for MogileFS
blob 6bbd19c72b732bb5631f6bef76b33905a8bbd594 630 bytes (raw)
$ git show gl-env:canonpath.c	# shows this blob on the CLI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
 
/*
 * Copyright (C) 2012-2016 all contributors <cmogstored-public@bogomips.org>
 * License: GPLv3 or later (see COPYING for details)
 */
#include "cmogstored.h"

char *mog_canonpath(const char *path, enum canonicalize_mode_t canon_mode)
{
	char *p = canonicalize_filename_mode(path, canon_mode);

	if (!p && errno == ENOMEM)
		mog_oom();

	return p; /* may be null if errors */
}

char *mog_canonpath_die(const char *path, enum canonicalize_mode_t canon_mode)
{
	char *p = mog_canonpath(path, canon_mode);

	if (p) return p;

	if (errno)
		die_errno("`%s' failed to resolve", path);
	else
		die("`%s' failed to resolve", path);
}

git clone https://yhbt.net/cmogstored.git