bakkeby / slock-flexipatch

An slock build with preprocessor directives to decide which patches to include during build time
MIT License
82 stars 27 forks source link

secret password patch results in an error #6

Closed aleuxser closed 2 years ago

aleuxser commented 2 years ago

Enabling the secret password patch (and using default configurations) results in a compiling error

$ doas make clean install
doas (user@desktop-pc) password:
cleaning
slock build options:
CFLAGS   = -std=c99 -pedantic -Wall -Os -I. -I/usr/include -I/usr/X11R6/include -DVERSION="1.4" -D_DEFAULT_SOURCE -DHAVE_SHADOW_H
LDFLAGS  = -s -L/usr/lib -lc -lcrypt -L/usr/X11R6/lib -lX11 -lXext -lXrandr
CC       = cc
CC slock.c
In file included from slock.c:96:
config.h:106:14: error: unknown type name 'secretpass'
  106 | static const secretpass scom[] = {
      |              ^~~~~~~~~~
config.h:108:9: warning: braces around scalar initializer
  108 |         { "shutdown",           "doas poweroff"},
      |         ^
config.h:108:9: note: (near initialization for 'scom[0]')
config.h:108:11: warning: initialization of 'int' from 'char *' makes integer from pointer without a cast [-Wint-conversion]
  108 |         { "shutdown",           "doas poweroff"},
      |           ^~~~~~~~~~
config.h:108:11: note: (near initialization for 'scom[0]')
config.h:108:11: error: initializer element is not computable at load time
config.h:108:11: note: (near initialization for 'scom[0]')
config.h:108:33: warning: excess elements in scalar initializer
  108 |         { "shutdown",           "doas poweroff"},
      |                                 ^~~~~~~~~~~~~~~
config.h:108:33: note: (near initialization for 'scom[0]')
slock.c: In function 'readpw':
slock.c:308:59: error: request for member 'pass' in something not a structure or union
  308 |                                         if (strcmp(scom[i].pass, passwd) == 0) {
      |                                                           ^
slock.c:309:63: error: request for member 'command' in something not a structure or union
  309 |                                                 system(scom[i].command);
      |                                                               ^
make: *** [Makefile:19: slock.o] Error 1
$
bakkeby commented 2 years ago

Thanks for reporting. This was working before when the patch was initially added, but looks to have been broken as part of introducing some other patch that resulted in config.h to be included before the secretpass struct was defined, causing the above compilation errors. Should be fixed after the above commit.

aleuxser commented 2 years ago

Works perfectly now. Thanks!