#!/usr/bin/env bash
# nosymlinks -- make all symlinks appear as regular files
#
# Used as wrapper for sftp-server as many Android SFTP clients do not support symlinks correctly.

objdir="${0%/*}/../obj/host.$HOSTNAME"
lib="$objdir/unsymlink.so"

if [ ! -f "$lib" ]; then
	echo "$0: missing '$lib'" >&2
fi

export LD_PRELOAD="$objdir/unsymlink.so${LD_PRELOAD+:}$LD_PRELOAD"

exec "$@"
