cfengine/cfengine-2.1.22-strict-aliasing-fix.diff

43 lines
1.1 KiB
Diff

--- src/link.c
+++ src/link.c
@@ -393,6 +393,10 @@
{ struct stat buf,savebuf;
char to[CF_BUFSIZE],linkbuf[CF_BUFSIZE],saved[CF_BUFSIZE],absto[CF_BUFSIZE],*lastnode;
struct UidList fakeuid;
+ union {
+ struct UidList *uifakeuid;
+ struct GidList *gifakeuid;
+ } ufakeuid = { &fakeuid };
struct Image ip;
char stamp[CF_BUFSIZE];
time_t STAMPNOW;
@@ -435,7 +439,7 @@
ip.plus = CF_SAMEMODE;
ip.minus = CF_SAMEMODE;
ip.uid = &fakeuid;
- ip.gid = (struct GidList *) &fakeuid;
+ ip.gid = ufakeuid.gifakeuid;
ip.action = "do";
ip.recurse = 0;
ip.type = 't';
@@ -858,6 +862,10 @@
{ struct stat frombuf,tobuf;
char saved[CF_BUFSIZE], *lastnode;
struct UidList fakeuid;
+ union {
+ struct UidList *uifakeuid;
+ struct GidList *gifakeuid;
+ } ufakeuid = { &fakeuid };
struct Image ip;
char stamp[CF_BUFSIZE];
time_t STAMPNOW;
@@ -888,7 +896,7 @@
ip.plus = CF_SAMEMODE;
ip.minus = CF_SAMEMODE;
ip.uid = &fakeuid;
- ip.gid = (struct GidList *) &fakeuid;
+ ip.gid = ufakeuid.gifakeuid;
ip.action = "do";
ip.recurse = 0;
ip.type = 't';