cmogstored.git  about / heads / tags
alternative mogstored implementation for MogileFS
blob 77c056f1b59fd532827ca028704e325ebb9ae05f 637 bytes (raw)
$ git show HEAD: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-2020 all contributors <cmogstored-public@yhbt.net>
 * License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
 */
#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