summaryrefslogtreecommitdiff
path: root/recipes-devtools/opkg/files/0004-opkg-symlink.patch
blob: e105a8f25716e4dc3438d5c674f1546a3df44ccb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
opkg refused to install when a symlink was in a path.
Have it follow symlinks when installing.
===================================================================
diff -Naru orig/libopkg/opkg_install.c new/libopkg/opkg_install.c
--- orig/libopkg/opkg_install.c	2020-09-08 14:08:55.550694837 -0500
+++ new/libopkg/opkg_install.c	2020-09-08 14:18:00.286678711 -0500
@@ -443,6 +443,17 @@
             pkg_t *obs;
             int existing_is_dir = file_is_dir(filename);
 
+            /* Existing patch might be a symlink, and still be OK */
+            if ((!existing_is_dir) && S_ISDIR(file_info->mode)) {
+                int rslt;
+                struct stat sbuf;
+
+                /* Use stat to follow a symlink */
+                rslt = stat(filename,&sbuf);
+                if((!rslt) && S_ISDIR(sbuf.st_mode))
+                    existing_is_dir = 1;  /* file_is_dir was wrong */
+            }
+
             /* OK if both the existing file and new file are directories. */
             if (existing_is_dir && S_ISDIR(file_info->mode)) {
                 continue;