diff options
author | Dan McGee <dan@archlinux.org> | 2007-02-14 15:54:35 +0000 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2007-02-14 15:54:35 +0000 |
commit | cd34ced4ada0bac8a370062fbc3cb58e3987cd33 (patch) | |
tree | 51da043fdf9256c6b950500828a69829aa521b7a /lib/libalpm/util.c | |
parent | 97f3a52a9b689a52e636917b1aed13b9543d0989 (diff) | |
download | pacman-cd34ced4ada0bac8a370062fbc3cb58e3987cd33.tar.xz |
* strlen -> mbstowcs (multibyte str to wide char str) conversion where we
want the actual number of characters, not the number of bytes.
* Added a TODO to take care of later in scriptlet processing.
Diffstat (limited to 'lib/libalpm/util.c')
-rw-r--r-- | lib/libalpm/util.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c index a9e773a5..359b8bfc 100644 --- a/lib/libalpm/util.c +++ b/lib/libalpm/util.c @@ -509,12 +509,19 @@ int _alpm_runscriptlet(char *root, char *installfn, char *script, char *ver, cha char line[1024]; if(fgets(line, 1024, pp) == NULL) break; + /*TODO clean this code up, remove weird SCRIPTLET_START/DONE, + * (void*)atol call, etc. */ /* "START <event desc>" */ - if((strlen(line) > strlen(SCRIPTLET_START)) && !strncmp(line, SCRIPTLET_START, strlen(SCRIPTLET_START))) { - EVENT(trans, PM_TRANS_EVT_SCRIPTLET_START, _alpm_strtrim(line + strlen(SCRIPTLET_START)), NULL); + if((strlen(line) > strlen(SCRIPTLET_START)) + && !strncmp(line, SCRIPTLET_START, strlen(SCRIPTLET_START))) { + EVENT(trans, PM_TRANS_EVT_SCRIPTLET_START, + _alpm_strtrim(line + strlen(SCRIPTLET_START)), NULL); /* "DONE <ret code>" */ - } else if((strlen(line) > strlen(SCRIPTLET_DONE)) && !strncmp(line, SCRIPTLET_DONE, strlen(SCRIPTLET_DONE))) { - EVENT(trans, PM_TRANS_EVT_SCRIPTLET_DONE, (void*)atol(_alpm_strtrim(line + strlen(SCRIPTLET_DONE))), NULL); + } else if((strlen(line) > strlen(SCRIPTLET_DONE)) + && !strncmp(line, SCRIPTLET_DONE, strlen(SCRIPTLET_DONE))) { + EVENT(trans, PM_TRANS_EVT_SCRIPTLET_DONE, + (void*)atol(_alpm_strtrim(line + strlen(SCRIPTLET_DONE))), + NULL); } else { _alpm_strtrim(line); /* log our script output */ @@ -526,7 +533,8 @@ int _alpm_runscriptlet(char *root, char *installfn, char *script, char *ver, cha exit(0); } else { if(waitpid(pid, 0, 0) == -1) { - _alpm_log(PM_LOG_ERROR, _("call to waitpid failed (%s)"), strerror(errno)); + _alpm_log(PM_LOG_ERROR, _("call to waitpid failed (%s)"), + strerror(errno)); retval = 1; goto cleanup; } |