summaryrefslogtreecommitdiffstats
path: root/commands/readlink.c
diff options
context:
space:
mode:
Diffstat (limited to 'commands/readlink.c')
-rw-r--r--commands/readlink.c26
1 files changed, 6 insertions, 20 deletions
diff --git a/commands/readlink.c b/commands/readlink.c
index 2dfa566675..55f8249028 100644
--- a/commands/readlink.c
+++ b/commands/readlink.c
@@ -1,21 +1,7 @@
-/*
- * readlink.c - read value of a symbolic link
- *
- * Copyright (c) 2012 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- */
+// SPDX-License-Identifier: GPL-2.0-only
+// SPDX-FileCopyrightText: © 2012 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+
+/* readlink.c - read value of a symbolic link */
#include <common.h>
#include <command.h>
@@ -45,7 +31,7 @@ static int do_readlink(int argc, char *argv[])
return COMMAND_ERROR_USAGE;
if (canonicalize) {
- char *buf = canonicalize_path(argv[optind]);
+ char *buf = canonicalize_path(AT_FDCWD, argv[optind]);
struct stat s;
if (!buf)
@@ -64,7 +50,7 @@ static int do_readlink(int argc, char *argv[])
return 0;
err:
- setenv(argv[optind + 1], "");
+ unsetenv(argv[optind + 1]);
return 1;
}