2018년 2월 21일 수요일

[MAN] strlcpy


Ref : http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0205gk/CJAEJFDB.html

strlcpy()

strlcpy() 함수는 NUL 종료 문자열 src에서 dst로 최고 size-1 문자를 복사합니다. 이 함수는 버퍼의 전체 크기(길이만이 아닌)를 차지하며 size가 0을 초과하는 한 NUL을 사용하여 결과를 종료합니다. size 값에 NUL에 해당하는 1바이트를 포함하십시오.
strlcpy() 함수는 공간 제한이 없었다면 복사되었을 문자열의 총 길이를 반환합니다. 이것은 충분한 공간이 있었는지에 따라 실제로 복사된 문자열의 길이와 동일할 수도 있고 그렇지 않을 수도 있습니다. 그러므로 필요한 공간이 어느 정도인지 확인하기 위해 strlcpy()를 한 번 호출한 다음 현재 공간이 충분하지 않을 경우 공간을 할당하고서 마지막에 strlcpy()를 두 번째로 호출하여 필요한 복사를 수행할 수 있습니다.
이 함수는 많은 C 라이브러리에 대한 공통 BSD 파생 확장입니다.

구문

extern size_t strlcpy(char *dst,  const char *src, size_t  size)

2018년 1월 29일 월요일

[Ubuntu16.04] Xshell4에서의 SSH 접속 설정

XShell4 (Xshell5 이하 버전)을 사용하여 Ubuntu16.04 서버에 SSH 접속 시 발생하는 오류 현상 및 해결방법에 대해 기술한다.

1.     현상
Ubuntu16.04 LTS 버전에 sshd 설치 후 Xshell4를 이용한 접속 시 서버에 맞는 outgoing encryption 알고리즘을 찾을 수 없습니다.” 팝업 발생 후 접속 불가

 


2.     대책 (아래 A, B 중 선택할 수 있다)
A.     Xshell5 버전으로 업데이트 한다.
B.     Xshell4 버전에서 지원하는 Ciphers를 서버의 sshd config 파일에 등록해 준다.
                         i.         참조 : http://manpages.ubuntu.com/manpages/zesty/man5/sshd_config.5.html
                        ii.         Xshell에서 지원하는 한 Cipher List 중 선택하여 /etc/ssh/ssh_config에 아래 내용을 추가한다.
$sudo vi /etc/ssh/ssh_config

    Ciphers aes256-cbc
$sudo service ssh restart

2017년 6월 11일 일요일

[WEB] PHP 환경 설정 변경(개발과정) - Error Display & Opcache

개발과정에서 Coding Error 및 빠른 업데이트를 위해 설정을 변경하자

php.ini 파일의 display_errors 화 opcache 옵션을 변경한다.
설정을 변경한 후에는 Apache Web Server를 Restart 해 줘야 변경사항을 적용된다.

상용버전에서는 Development 옵션은 지양한다.

; This directive controls whether or not and where PHP will output errors,
; notices and warnings too. Error output is very useful during development, but
; it could be very dangerous in production environments. Depending on the code
; which is triggering the error, sensitive information could potentially leak
; out of your application such as database usernames and passwords or worse.
; For production environments, we recommend logging errors rather than
; sending them to STDOUT.
; Possible Values:
;   Off = Do not display any errors
;   stderr = Display errors to STDERR (affects only CGI/CLI binaries!)
;   On or stdout = Display errors to STDOUT
; Default Value: On
; Development Value: On
; Production Value: Off
; http://php.net/display-errors
display_errors = On

[opcache]
zend_extension=php_opcache.dll
; Determines if Zend OPCache is enabled
; opcache.enable=1 -> 0 // 수정 즉시 반영되도록 설정
opcache.enable=0

[Ubuntu] Warning sudo: unable to resolve host

Ubuntu 설치 후 hostname을 /etc/hostname 파일만 변경한 경우, 아래와 같은 warning 문구가 표시된다.
Warning 제거는 hosts 파일(/etc/hosts) 에 변경된 hostname을 추가해 준다.

** warning message : sudo : unable to resolve host

원인 : /etc/hostname 에 적용된 hostname 이 /etc/hosts 파일에 등록되어 있지 않음.
대책 : /etc/hosts 파일에 변경된 hostname 추가

2017년 2월 3일 금요일

[Ubuntu] warning message 처리 (sudo : unable to resolve host)


Ubuntu 설치 후 hostname을 /etc/hostname 파일만 변경한 경우, 아래와 같은 warning 문구가 표시된다.

[ warning message ]
-  sudo : unable to resolve host

원인 : /etc/hostname 에 적용된 hostname 이 /etc/hosts 파일에 등록되어 있지 않음.
대책 : /etc/hosts 파일에 변경된 hostname 추가

$ sudo vi /etc/hostname
127.0..0.1 [HOSTNAME]  <-- [HOSTNAME] : 실제 hostname

2016년 8월 24일 수요일

[KERNEL] make menuconfig error - resolve

[KERNEL] make menuconfig error - resolve 

#kernel #menuconfig

OS

  • ubuntun 12.04 LTS

Resolve 
  • $ sudo apt-get install lib32ncurses5-dev

Error Log

$ make menuconfig [enter]
scripts/kconfig/lxdialog/menubox.o: In function `do_scroll':
menubox.c:(.text+0x55): undefined reference to `wrefresh'
scripts/kconfig/lxdialog/menubox.o: In function `print_arrows':
menubox.c:(.text+0x1a4): undefined reference to `wrefresh'
scripts/kconfig/lxdialog/menubox.o: In function `do_print_item':
menubox.c:(.text+0x3a9): undefined reference to `wrefresh'
scripts/kconfig/lxdialog/menubox.o: In function `print_buttons':
menubox.c:(.text+0x4b1): undefined reference to `wrefresh'
collect2: ld returned 1 exit status
make[1]: *** [scripts/kconfig/mconf] Error 1
make: *** [menuconfig] Error 2

Android 7.0 Nougat 소스인출

Android 7.0 Nougat source 코드가 올라왔다.

Branch 확인하고 소스인출까지 1시간 30분 정도 소요된 듯..
- https://android.googlesource.com/platform/manifest

$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod +x ~/bin/repo 

$ mkdir android-7.0.0_r1
$ cd android-7.0.0_r1/

$ git config --global user.name "Wonseok.Choi"
$ git config --global user.emali "soma.wschoi@gmail.com"

$ repo init -u https://android.googlesource.com/platform/manifest
$ repo init -u https://android.googlesource.com/platform/manifest -b android-7.0.0_r1
$ repo sync

#android #nougat #repo