[PATCH] opkg_conf: check if tmp_dir exists before deleting

4 views
Skip to first unread message

Shruthi Ravichandran

unread,
Jun 27, 2022, 6:54:09 PM6/27/22
to opkg-...@googlegroups.com, Shruthi Ravichandran
rm_r prints an error message if the directory to be deleted does not
exist. There are some opkg commands that do not error, but print the
rm_r error message re: the tmp_dir during cleanup unnecessarily.
Therefore, check if the tmp_dir exists before trying to delete it.

Signed-off-by: Shruthi Ravichandran <shruthi.ra...@ni.com>
---
libopkg/opkg_conf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libopkg/opkg_conf.c b/libopkg/opkg_conf.c
index 37fcd2c..e13ebc1 100644
--- a/libopkg/opkg_conf.c
+++ b/libopkg/opkg_conf.c
@@ -906,7 +906,7 @@ void opkg_conf_deinit(void)
int i;
char **tmp;

- if (opkg_config->tmp_dir)
+ if (opkg_config->tmp_dir && file_exists(opkg_config->tmp_dir))
rm_r(opkg_config->tmp_dir);

if (opkg_config->volatile_cache && file_exists(opkg_config->cache_dir))
--
2.20.1

Alex Stewart

unread,
Jun 28, 2022, 10:42:05 AM6/28/22
to Shruthi Ravichandran, opkg-...@googlegroups.com
This change looks good to me. Thanks.

I'll pull this tomorrow (Wednesday), unless there are objections from
the list.
Alex Stewart
Software Engineer - NI Real-Time OS
NI (National Instruments)

alex.s...@ni.com

Alex Stewart

unread,
Jun 29, 2022, 12:22:48 PM6/29/22
to Shruthi Ravichandran, opkg-...@googlegroups.com
I've merged this PR to master as commit
8dfdda86afd407a66e3dc00a077bdcc8b53d54ea [1].

[1]
https://git.yoctoproject.org/opkg/commit/?id=8dfdda86afd407a66e3dc00a077bdcc8b53d54ea

Thanks,

On 6/27/22 17:53, Shruthi Ravichandran wrote:
Reply all
Reply to author
Forward
0 new messages